Skip to content

Commit 84790d6

Browse files
committed
add tests to equalTo with more than one condition and with the same key
1 parent dffe023 commit 84790d6

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/Parse/ParseQueryTest.php

+52
Original file line numberDiff line numberDiff line change
@@ -2720,4 +2720,56 @@ public function testUnknownCondition()
27202720
'unrecognized' => 1
27212721
]);
27222722
}
2723+
2724+
public function testEqualToWithSameKeyAndWithOthersConditionsReturnWrongResult()
2725+
{
2726+
$baz = new ParseObject('TestObject');
2727+
$baz->setArray('fooStack', [
2728+
[
2729+
'status' => 'baz'
2730+
],
2731+
[
2732+
'status' => 'bar'
2733+
]
2734+
]);
2735+
$baz->save();
2736+
2737+
$bar = new ParseObject('TestObject');
2738+
$bar->setArray('fooStack', [
2739+
[
2740+
'status' => 'bar'
2741+
]
2742+
]);
2743+
$bar->save();
2744+
2745+
$qux = new ParseObject('TestObject');
2746+
$qux->setArray('fooStack', [
2747+
[
2748+
'status' => 'bar',
2749+
],
2750+
[
2751+
'status' => 'qux'
2752+
]
2753+
]);
2754+
$qux->save();
2755+
2756+
$query = new ParseQuery('TestObject');
2757+
$query->notEqualTo('fooStack.status', 'baz');
2758+
$query->equalTo('fooStack.status', 'bar');
2759+
2760+
$this->assertEquals(3, $query->count(true));
2761+
}
2762+
2763+
public function testEqualToWithSameKeyAndOthersConditionsReturnStructQueryWrong()
2764+
{
2765+
$query = new ParseQuery('TestObject');
2766+
$query->notEqualTo('key', 'value3');
2767+
$query->equalTo('key', 'value');
2768+
2769+
$this->assertSame([
2770+
'where' => [
2771+
'key' => 'value'
2772+
]
2773+
], $query->_getOptions());
2774+
}
27232775
}

0 commit comments

Comments
 (0)