Skip to content

Commit 96ccc6d

Browse files
authored
Fix PHPUnit Risky Tests (#449)
Some tests were missing assert
1 parent 942dcc2 commit 96ccc6d

10 files changed

+26
-7
lines changed

tests/Parse/ParseACLTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ public function testACLRequiresObjectId()
352352
$this->fail('Exception should have thrown');
353353
} catch (Exception $e) {
354354
}
355+
$this->assertTrue(true);
355356
}
356357

357358
public function testIncludedObjectsGetACLs()

tests/Parse/ParseMemoryStorageTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,6 @@ public function testSave()
7171
{
7272
// does nothing
7373
self::$parseStorage->save();
74+
$this->assertTrue(true);
7475
}
7576
}

tests/Parse/ParseObjectTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function testCreate()
4545
$obj = ParseObject::create('TestObject');
4646
$obj->set('test', 'test');
4747
$obj->save();
48+
$this->assertEquals($obj->get('test'), 'test');
4849
}
4950

5051
public function testUpdate()
@@ -649,6 +650,7 @@ public function testManySaveAfterAFailure()
649650
if ($exceptions != 3) {
650651
$this->fail('Did not cause expected # of exceptions.');
651652
}
653+
$this->assertTrue(true);
652654
}
653655

654656
public function testNewKeyIsDirtyAfterSave()
@@ -865,6 +867,7 @@ public function testArraySetAndAdd()
865867
$obj->save();
866868
$obj->add('arrayfield', ['c', 'd', 'e']);
867869
$obj->save();
870+
$this->assertEquals($obj->get('arrayfield'), ['a', 'b', 'c', 'd', 'e']);
868871
}
869872

870873
public function testObjectIsDirty()
@@ -1443,6 +1446,7 @@ public function testDestroyingUnsaved()
14431446
{
14441447
$obj = new ParseObject('TestClass');
14451448
$obj->destroy();
1449+
$this->assertTrue(true);
14461450
}
14471451

14481452
public function testEncodeWithArray()

tests/Parse/ParsePushTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ public function testNoMasterKey()
3434

3535
public function testBasicPush()
3636
{
37-
ParsePush::send(
37+
$response = ParsePush::send(
3838
[
3939
'channels' => [''],
4040
'data' => ['alert' => 'sample message'],
4141
],
4242
true
4343
);
44+
$this->assertEquals($response['result'], 1);
4445
}
4546

4647
/**
@@ -89,25 +90,27 @@ public function testPushToQuery()
8990
{
9091
$query = ParseInstallation::query();
9192
$query->equalTo('key', 'value');
92-
ParsePush::send(
93+
$response = ParsePush::send(
9394
[
9495
'data' => ['alert' => 'iPhone 5 is out!'],
9596
'where' => $query,
9697
],
9798
true
9899
);
100+
$this->assertEquals($response['result'], 1);
99101
}
100102

101103
public function testPushToQueryWithoutWhere()
102104
{
103105
$query = ParseInstallation::query();
104-
ParsePush::send(
106+
$response = ParsePush::send(
105107
[
106108
'data' => ['alert' => 'Done without conditions!'],
107109
'where' => $query,
108110
],
109111
true
110112
);
113+
$this->assertEquals($response['result'], 1);
111114
}
112115

113116
public function testNonQueryWhere()
@@ -127,7 +130,7 @@ public function testNonQueryWhere()
127130

128131
public function testPushDates()
129132
{
130-
ParsePush::send(
133+
$response = ParsePush::send(
131134
[
132135
'data' => ['alert' => 'iPhone 5 is out!'],
133136
'push_time' => new \DateTime(),
@@ -136,6 +139,7 @@ public function testPushDates()
136139
],
137140
true
138141
);
142+
$this->assertEquals($response['result'], 1);
139143
}
140144

141145
public function testExpirationTimeAndIntervalSet()

tests/Parse/ParseRelationOperationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,6 @@ public function testRemoveMissingObjectId()
172172
$obj = new ParseObject('Class1');
173173
$op = new ParseRelationOperation(null, $obj);
174174
$op->_mergeWithPrevious(new ParseRelationOperation(null, $obj));
175+
$this->assertTrue(true);
175176
}
176177
}

tests/Parse/ParseRelationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,5 +217,8 @@ public function testBiDirectionalRelations()
217217

218218
$child2->save();
219219
$parent->save();
220+
$this->assertEquals($parent->get('children'), [$child, $child2]);
221+
$this->assertEquals($child->get('parent'), $parent);
222+
$this->assertEquals($child2->get('parent'), $parent);
220223
}
221224
}

tests/Parse/ParseRoleTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ public function testRoleHierarchyAndPropagation()
167167

168168
// verify the snake can still enter the garden
169169
ParseUser::logIn('snake', 'snake');
170-
$query->get($eden['garden']->getObjectId());
171-
170+
$garden = $query->get($eden['garden']->getObjectId());
171+
$this->assertEquals($garden->getObjectId(), $eden['garden']->getObjectId());
172172
ParseUser::logOut();
173173
}
174174

@@ -184,7 +184,8 @@ public function testAddUserAfterFetch()
184184
$roleAgain = $query->get($role->getObjectId());
185185
$roleAgain->getUsers()->add($user);
186186
$roleAgain->save();
187-
187+
$users = $roleAgain->getUsers()->getQuery()->find();
188+
$this->assertEquals($user->getObjectId(), $users[0]->getObjectId());
188189
ParseUser::logOut();
189190
}
190191

tests/Parse/ParseSchemaTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ public function testPurgingNonexistentSchema()
266266
// exception on earlier versions > 2.8, no exception on >= 2.8
267267
// thus hard to test for this unless version detection is utilized here
268268
}
269+
$this->assertTrue(true);
269270
}
270271

271272
public function testDeleteSchema()

tests/Parse/ParseSessionStorageTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public function testSave()
8686
{
8787
// does nothing
8888
self::$parseStorage->save();
89+
$this->assertTrue(true);
8990
}
9091

9192
/**

tests/Parse/ParseUserTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ public function testPasswordReset()
457457
$user->signUp();
458458

459459
ParseUser::requestPasswordReset('asdf@example.com');
460+
$this->assertTrue(true);
460461
}
461462

462463
public function testUserAssociations()
@@ -712,6 +713,7 @@ public function testRequestVerificationEmail()
712713
$user->setEmail($email);
713714
$user->signUp();
714715
ParseUser::requestVerificationEmail($email);
716+
$this->assertTrue(true);
715717
}
716718

717719
/**

0 commit comments

Comments
 (0)