Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions tests/Parse/ParseQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2719,4 +2719,56 @@ public function testUnknownCondition()
'unrecognized' => 1
]);
}

public function testEqualToWithSameKeyAndWithOthersConditionsReturnWrongResult()
{
$baz = new ParseObject('TestObject');
$baz->setArray('fooStack', [
[
'status' => 'baz'
],
[
'status' => 'bar'
]
]);
$baz->save();

$bar = new ParseObject('TestObject');
$bar->setArray('fooStack', [
[
'status' => 'bar'
]
]);
$bar->save();

$qux = new ParseObject('TestObject');
$qux->setArray('fooStack', [
[
'status' => 'bar',
],
[
'status' => 'qux'
]
]);
$qux->save();

$query = new ParseQuery('TestObject');
$query->notEqualTo('fooStack.status', 'baz');
$query->equalTo('fooStack.status', 'bar');

$this->assertEquals(3, $query->count(true));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the expected results? Should these test fail instead of passing?

Copy link
Author

@igor-mobapps igor-mobapps Jun 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, they must fail.

Only tests have been done, once the fix cited in #476 is implemented, they should fail

}

public function testEqualToWithSameKeyAndOthersConditionsReturnStructQueryWrong()
{
$query = new ParseQuery('TestObject');
$query->notEqualTo('key', 'value3');
$query->equalTo('key', 'value');

$this->assertSame([
'where' => [
'key' => 'value'
]
], $query->_getOptions());
}
}