2424namespace Facebook \Tests \Authentication ;
2525
2626use Facebook \Authentication \AccessTokenMetadata ;
27+ use Facebook \Exceptions \FacebookSDKException ;
28+ use Facebook \Tests \BaseTestCase ;
2729
28- class AccessTokenMetadataTest extends \PHPUnit_Framework_TestCase
30+ class AccessTokenMetadataTest extends BaseTestCase
2931{
3032
3133 protected $ graphResponseData = [
@@ -51,7 +53,7 @@ class AccessTokenMetadataTest extends \PHPUnit_Framework_TestCase
5153 ],
5254 ];
5355
54- public function testDatesGetCastToDateTime ()
56+ public function testDatesGetCastToDateTime (): void
5557 {
5658 $ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
5759
@@ -62,7 +64,7 @@ public function testDatesGetCastToDateTime()
6264 $ this ->assertInstanceOf ('DateTime ' , $ issuedAt );
6365 }
6466
65- public function testAllTheGettersReturnTheProperValue ()
67+ public function testAllTheGettersReturnTheProperValue (): void
6668 {
6769 $ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
6870
@@ -81,56 +83,51 @@ public function testAllTheGettersReturnTheProperValue()
8183 $ this ->assertEquals ('1337 ' , $ metadata ->getUserId ());
8284 }
8385
84- /**
85- * @expectedException \Facebook\Exceptions\FacebookSDKException
86- */
87- public function testInvalidMetadataWillThrow ()
86+ public function testInvalidMetadataWillThrow (): void
8887 {
88+ $ this ->expectException (FacebookSDKException::class);
8989 new AccessTokenMetadata (['foo ' => 'bar ' ]);
9090 }
9191
92- public function testAnExpectedAppIdWillNotThrow ()
92+ public function testAnExpectedAppIdWillNotThrow (): void
9393 {
9494 $ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
9595 $ metadata ->validateAppId ('123 ' );
9696 }
9797
98- /**
99- * @expectedException \Facebook\Exceptions\FacebookSDKException
100- */
101- public function testAnUnexpectedAppIdWillThrow ()
98+ public function testAnUnexpectedAppIdWillThrow (): void
10299 {
100+ $ this ->expectException (FacebookSDKException::class);
101+
103102 $ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
104103 $ metadata ->validateAppId ('foo ' );
105104 }
106105
107- public function testAnExpectedUserIdWillNotThrow ()
106+ public function testAnExpectedUserIdWillNotThrow (): void
108107 {
109108 $ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
110109 $ metadata ->validateUserId ('1337 ' );
111110 }
112111
113- /**
114- * @expectedException \Facebook\Exceptions\FacebookSDKException
115- */
116- public function testAnUnexpectedUserIdWillThrow ()
112+ public function testAnUnexpectedUserIdWillThrow (): void
117113 {
114+ $ this ->expectException (FacebookSDKException::class);
115+
118116 $ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
119117 $ metadata ->validateUserId ('foo ' );
120118 }
121119
122- public function testAnActiveAccessTokenWillNotThrow ()
120+ public function testAnActiveAccessTokenWillNotThrow (): void
123121 {
124122 $ this ->graphResponseData ['data ' ]['expires_at ' ] = time () + 1000 ;
125123 $ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
126124 $ metadata ->validateExpiration ();
127125 }
128126
129- /**
130- * @expectedException \Facebook\Exceptions\FacebookSDKException
131- */
132- public function testAnExpiredAccessTokenWillThrow ()
127+ public function testAnExpiredAccessTokenWillThrow (): void
133128 {
129+ $ this ->expectException (\Facebook \Exceptions \FacebookSDKException::class);
130+
134131 $ this ->graphResponseData ['data ' ]['expires_at ' ] = time () - 1000 ;
135132 $ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
136133 $ metadata ->validateExpiration ();
0 commit comments