Skip to content

Commit e8e5737

Browse files
authored
Merge pull request facebookarchive#900 from carusogabriel/refactoring-tests
Refactoring tests
2 parents 8875d3c + 7da6778 commit e8e5737

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

tests/BatchResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function testABatchResponseCanBeIteratedOver()
107107
$this->assertInstanceOf(\IteratorAggregate::class, $batchResponse);
108108

109109
foreach ($batchResponse as $key => $responseEntity) {
110-
$this->assertTrue(in_array($key, ['req_one', 'req_two', 'req_three']));
110+
$this->assertContains($key, ['req_one', 'req_two', 'req_three']);
111111
$this->assertInstanceOf(Response::class, $responseEntity);
112112
}
113113
}

tests/FacebookTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function testCreatingANewBatchRequestWillDefaultToTheProperConfig()
220220
$fb->getClient()->getBaseGraphUrl()
221221
);
222222
$this->assertInstanceOf('Facebook\BatchRequest', $batchRequest);
223-
$this->assertEquals(0, count($batchRequest->getRequests()));
223+
$this->assertCount(0, $batchRequest->getRequests());
224224
}
225225

226226
public function testCanInjectCustomHandlers()

tests/GraphNode/CollectionTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ public function testACollectionCanBeCounted()
108108
{
109109
$collection = new Collection(['foo', 'bar', 'baz']);
110110

111-
$collectionCount = count($collection);
112-
113-
$this->assertEquals(3, $collectionCount);
111+
$this->assertCount(3, $collection);
114112
}
115113

116114
public function testACollectionCanBeAccessedAsAnArray()

tests/GraphNode/GraphAchievementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testNoFeedStoryIsBoolean()
6666

6767
$isNoFeedStory = $graphNode->isNoFeedStory();
6868

69-
$this->assertTrue(is_bool($isNoFeedStory));
69+
$this->assertInternalType('bool', $isNoFeedStory);
7070
}
7171

7272
public function testDatesGetCastToDateTime()

tests/RequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function testAFileCanBeAddedToParams()
182182

183183
$this->assertTrue($request->containsFileUploads());
184184
$this->assertFalse($request->containsVideoUploads());
185-
$this->assertFalse(isset($actualParams['source']));
185+
$this->assertArrayNotHasKey('source', $actualParams);
186186
$this->assertEquals('Foo Bar', $actualParams['name']);
187187
}
188188

@@ -200,7 +200,7 @@ public function testAVideoCanBeAddedToParams()
200200

201201
$this->assertTrue($request->containsFileUploads());
202202
$this->assertTrue($request->containsVideoUploads());
203-
$this->assertFalse(isset($actualParams['source']));
203+
$this->assertArrayNotHasKey('source', $actualParams);
204204
$this->assertEquals('Foo Bar', $actualParams['name']);
205205
}
206206
}

0 commit comments

Comments
 (0)