Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

Commit 351d170

Browse files
committed
Fix: Use more appropriate assertions
1 parent e3b49ec commit 351d170

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

tests/Authentication/OAuth2ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testCanBuildAuthorizationUrl()
8282
$this->assertContains('*', $authUrl);
8383

8484
$expectedUrl = 'https://www.facebook.com/' . static::TESTING_GRAPH_VERSION . '/dialog/oauth?';
85-
$this->assertTrue(strpos($authUrl, $expectedUrl) === 0, 'Unexpected base authorization URL returned from getAuthorizationUrl().');
85+
$this->assertStringStartsWith($expectedUrl, $authUrl, 'Unexpected base authorization URL returned from getAuthorizationUrl().');
8686

8787
$params = [
8888
'client_id' => '123',

tests/FacebookRequestTest.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->assertTrue(!isset($actualParams['source']));
185+
$this->assertFalse(isset($actualParams['source']));
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->assertTrue(!isset($actualParams['source']));
203+
$this->assertFalse(isset($actualParams['source']));
204204
$this->assertEquals('Foo Bar', $actualParams['name']);
205205
}
206206
}

tests/GraphNodes/CollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testFalseDefaultsWillReturnSameType()
7171
$this->assertSame(0, $field);
7272

7373
$field = $graphNode->getField('baz', false);
74-
$this->assertSame(false, $field);
74+
$this->assertFalse($field);
7575
}
7676

7777
public function testTheKeysFromTheCollectionCanBeReturned()

tests/Helpers/FacebookRedirectLoginHelperTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function testLoginURL()
5959
$loginUrl = $this->redirectLoginHelper->getLoginUrl(self::REDIRECT_URL, $scope);
6060

6161
$expectedUrl = 'https://www.facebook.com/v1337/dialog/oauth?';
62-
$this->assertTrue(strpos($loginUrl, $expectedUrl) === 0, 'Unexpected base login URL returned from getLoginUrl().');
62+
$this->assertStringStartsWith($expectedUrl, $loginUrl, 'Unexpected base login URL returned from getLoginUrl().');
6363

6464
$params = [
6565
'client_id' => '123',
@@ -77,16 +77,14 @@ public function testLogoutURL()
7777
{
7878
$logoutUrl = $this->redirectLoginHelper->getLogoutUrl('foo_token', self::REDIRECT_URL);
7979
$expectedUrl = 'https://www.facebook.com/logout.php?';
80-
$this->assertTrue(strpos($logoutUrl, $expectedUrl) === 0, 'Unexpected base logout URL returned from getLogoutUrl().');
80+
$this->assertStringStartsWith($expectedUrl, $logoutUrl, 'Unexpected base logout URL returned from getLogoutUrl().');
8181

8282
$params = [
8383
'next' => self::REDIRECT_URL,
8484
'access_token' => 'foo_token',
8585
];
8686
foreach ($params as $key => $value) {
87-
$this->assertTrue(
88-
strpos($logoutUrl, $key . '=' . urlencode($value)) !== false
89-
);
87+
$this->assertContains($key . '=' . urlencode($value), $logoutUrl);
9088
}
9189
}
9290

0 commit comments

Comments
 (0)