24
24
namespace Facebook \Tests \Authentication ;
25
25
26
26
use Facebook \Authentication \AccessTokenMetadata ;
27
+ use Facebook \Exceptions \FacebookSDKException ;
28
+ use Facebook \Tests \BaseTestCase ;
27
29
28
- class AccessTokenMetadataTest extends \PHPUnit_Framework_TestCase
30
+ class AccessTokenMetadataTest extends BaseTestCase
29
31
{
30
32
31
33
protected $ graphResponseData = [
@@ -51,7 +53,7 @@ class AccessTokenMetadataTest extends \PHPUnit_Framework_TestCase
51
53
],
52
54
];
53
55
54
- public function testDatesGetCastToDateTime ()
56
+ public function testDatesGetCastToDateTime (): void
55
57
{
56
58
$ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
57
59
@@ -62,7 +64,7 @@ public function testDatesGetCastToDateTime()
62
64
$ this ->assertInstanceOf ('DateTime ' , $ issuedAt );
63
65
}
64
66
65
- public function testAllTheGettersReturnTheProperValue ()
67
+ public function testAllTheGettersReturnTheProperValue (): void
66
68
{
67
69
$ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
68
70
@@ -81,56 +83,51 @@ public function testAllTheGettersReturnTheProperValue()
81
83
$ this ->assertEquals ('1337 ' , $ metadata ->getUserId ());
82
84
}
83
85
84
- /**
85
- * @expectedException \Facebook\Exceptions\FacebookSDKException
86
- */
87
- public function testInvalidMetadataWillThrow ()
86
+ public function testInvalidMetadataWillThrow (): void
88
87
{
88
+ $ this ->expectException (FacebookSDKException::class);
89
89
new AccessTokenMetadata (['foo ' => 'bar ' ]);
90
90
}
91
91
92
- public function testAnExpectedAppIdWillNotThrow ()
92
+ public function testAnExpectedAppIdWillNotThrow (): void
93
93
{
94
94
$ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
95
95
$ metadata ->validateAppId ('123 ' );
96
96
}
97
97
98
- /**
99
- * @expectedException \Facebook\Exceptions\FacebookSDKException
100
- */
101
- public function testAnUnexpectedAppIdWillThrow ()
98
+ public function testAnUnexpectedAppIdWillThrow (): void
102
99
{
100
+ $ this ->expectException (FacebookSDKException::class);
101
+
103
102
$ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
104
103
$ metadata ->validateAppId ('foo ' );
105
104
}
106
105
107
- public function testAnExpectedUserIdWillNotThrow ()
106
+ public function testAnExpectedUserIdWillNotThrow (): void
108
107
{
109
108
$ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
110
109
$ metadata ->validateUserId ('1337 ' );
111
110
}
112
111
113
- /**
114
- * @expectedException \Facebook\Exceptions\FacebookSDKException
115
- */
116
- public function testAnUnexpectedUserIdWillThrow ()
112
+ public function testAnUnexpectedUserIdWillThrow (): void
117
113
{
114
+ $ this ->expectException (FacebookSDKException::class);
115
+
118
116
$ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
119
117
$ metadata ->validateUserId ('foo ' );
120
118
}
121
119
122
- public function testAnActiveAccessTokenWillNotThrow ()
120
+ public function testAnActiveAccessTokenWillNotThrow (): void
123
121
{
124
122
$ this ->graphResponseData ['data ' ]['expires_at ' ] = time () + 1000 ;
125
123
$ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
126
124
$ metadata ->validateExpiration ();
127
125
}
128
126
129
- /**
130
- * @expectedException \Facebook\Exceptions\FacebookSDKException
131
- */
132
- public function testAnExpiredAccessTokenWillThrow ()
127
+ public function testAnExpiredAccessTokenWillThrow (): void
133
128
{
129
+ $ this ->expectException (\Facebook \Exceptions \FacebookSDKException::class);
130
+
134
131
$ this ->graphResponseData ['data ' ]['expires_at ' ] = time () - 1000 ;
135
132
$ metadata = new AccessTokenMetadata ($ this ->graphResponseData );
136
133
$ metadata ->validateExpiration ();
0 commit comments