Skip to content

Updates various tests. #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 14, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Parse/ParseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ final class ParseClient
*
* @var string
*/
const VERSION_STRING = 'php1.2.2';
const VERSION_STRING = 'php1.2.7';

/**
* Parse\Client::initialize, must be called before using Parse features.
Expand Down
3 changes: 2 additions & 1 deletion tests/Parse/ParseClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ public function testBadApiResponse()
$httpClient = ParseClient::getHttpClient();

// create a mock of the current http client
$stubClient = $this->createMock(get_class($httpClient));
$stubClient = $this->getMockBuilder(get_class($httpClient))
->getMock();

// stub the response type to return
// something we will try to work with
Expand Down
42 changes: 23 additions & 19 deletions tests/Parse/ParseQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1499,20 +1499,23 @@ public function testOrderByCreatedAtDesc()
}
}

/**
* @group order-by-updated-at
*/
public function testOrderByUpdatedAtAsc()
{
$numbers = [3, 1, 2];
$objects = [];
$this->saveObjects(
3,
function ($i) use ($numbers, &$objects) {
$obj = ParseObject::create('TestObject');
$obj->set('number', $numbers[$i]);
$objects[] = $obj;

return $obj;
}
);
foreach($numbers as $num) {
$obj = ParseObject::create('TestObject');
$obj->set('number', $num);
$obj->save();
$objects[] = $obj;
sleep(1);

}

$objects[1]->set('number', 4);
$objects[1]->save();
$query = new ParseQuery('TestObject');
Expand Down Expand Up @@ -1541,16 +1544,16 @@ public function testOrderByUpdatedAtDesc()
{
$numbers = [3, 1, 2];
$objects = [];
$this->saveObjects(
3,
function ($i) use ($numbers, &$objects) {
$obj = ParseObject::create('TestObject');
$obj->set('number', $numbers[$i]);
$objects[] = $obj;

return $obj;
}
);
foreach($numbers as $num) {
$obj = ParseObject::create('TestObject');
$obj->set('number', $num);
$obj->save();
$objects[] = $obj;
sleep(1);

}

$objects[1]->set('number', 4);
$objects[1]->save();
$query = new ParseQuery('TestObject');
Expand All @@ -1561,7 +1564,8 @@ function ($i) use ($numbers, &$objects) {
count($results),
'Did not return correct number of objects.'
);
$expected = [4, 3, 2];

$expected = [4, 2, 3];
for ($i = 0; $i < 3; ++$i) {
$this->assertEquals(
$expected[$i],
Expand Down