16
16
class AuthenticatorTest extends TestCase {
17
17
public function testConstructWithDefaultSessionNotStarted () {
18
18
self ::expectException (SessionNotStartedException::class);
19
- new Authenticator ("test-key " ,"/ " );
19
+ new Authenticator (
20
+ "test-key " ,
21
+ "example.com " ,
22
+ "/ "
23
+ );
20
24
}
21
25
22
26
public function testConstructWithDefaultSession () {
23
27
$ _SESSION = [];
24
- new Authenticator ("test-key " , "/ " );
28
+ new Authenticator (
29
+ "test-key " ,
30
+ "example.com " ,
31
+ "/ "
32
+ );
25
33
self ::assertArrayHasKey (
26
34
Authenticator::SESSION_KEY ,
27
35
$ _SESSION
@@ -32,6 +40,7 @@ public function testIsLoggedInFalseByDefault() {
32
40
$ _SESSION = [];
33
41
$ sut = new Authenticator (
34
42
"test-key " ,
43
+ "example.com " ,
35
44
"/ "
36
45
);
37
46
self ::assertFalse ($ sut ->isLoggedIn ());
@@ -50,7 +59,8 @@ public function testIsLoggedInTrueWhenSessionDataSet() {
50
59
51
60
$ sut = new Authenticator (
52
61
"test-key " ,
53
- "/ " ,
62
+ "example.com " ,
63
+ "/ "
54
64
);
55
65
self ::assertTrue ($ sut ->isLoggedIn ());
56
66
}
@@ -63,7 +73,8 @@ public function testLogoutClearsSession() {
63
73
64
74
$ sut = new Authenticator (
65
75
"test-key " ,
66
- "/ " ,
76
+ "example.com " ,
77
+ "/ "
67
78
);
68
79
$ sut ->logout ();
69
80
self ::assertEmpty ($ _SESSION );
@@ -81,6 +92,7 @@ public function testLoginRedirects() {
81
92
82
93
$ sut = new Authenticator (
83
94
"test-key " ,
95
+ "example.com " ,
84
96
"/ " ,
85
97
AuthUri::DEFAULT_BASE_URI ,
86
98
null ,
@@ -103,6 +115,7 @@ public function testLoginRedirectsLocalhost() {
103
115
104
116
$ sut = new Authenticator (
105
117
"test-key " ,
118
+ "example.com " ,
106
119
"/ " ,
107
120
"http://localhost:8081 " ,
108
121
null ,
@@ -146,6 +159,7 @@ public function testLoginRedirectsWithCorrectQueryString() {
146
159
147
160
$ sut = new Authenticator (
148
161
$ key ,
162
+ "example.com " ,
149
163
$ currentPath ,
150
164
AuthUri::DEFAULT_BASE_URI ,
151
165
null ,
@@ -166,6 +180,7 @@ public function testLoginDoesNothingWhenAlreadyLoggedIn() {
166
180
167
181
$ sut = new Authenticator (
168
182
"test-key " ,
183
+ "example.com " ,
169
184
"/ " ,
170
185
AuthUri::DEFAULT_BASE_URI ,
171
186
null ,
@@ -179,6 +194,7 @@ public function testGetUuidThrowsExceptionWhenNotLoggedIn() {
179
194
$ _SESSION = [];
180
195
$ sut = new Authenticator (
181
196
"test-key " ,
197
+ "example.com " ,
182
198
"/ "
183
199
);
184
200
self ::expectException (NotLoggedInException::class);
@@ -200,6 +216,7 @@ public function testGetUuid() {
200
216
];
201
217
$ sut = new Authenticator (
202
218
"test-key " ,
219
+ "example.com " ,
203
220
"/ "
204
221
);
205
222
self ::assertEquals ($ expectedUuid , $ sut ->getUuid ());
@@ -209,6 +226,7 @@ public function testGetEmailThrowsExceptionWhenNotLoggedIn() {
209
226
$ _SESSION = [];
210
227
$ sut = new Authenticator (
211
228
"test-key " ,
229
+ "example.com " ,
212
230
"/ "
213
231
);
214
232
self ::expectException (NotLoggedInException::class);
@@ -230,6 +248,7 @@ public function testGetEmail() {
230
248
];
231
249
$ sut = new Authenticator (
232
250
"test-key " ,
251
+ "example.com " ,
233
252
"/ "
234
253
);
235
254
self ::assertEquals ($ expectedEmail , $ sut ->getEmail ());
@@ -244,6 +263,7 @@ public function testCompleteAuthNotLoggedIn() {
244
263
self ::expectException (NotLoggedInException::class);
245
264
new Authenticator (
246
265
"test-key " ,
266
+ "example.com " ,
247
267
$ currentUri
248
268
);
249
269
}
@@ -276,6 +296,7 @@ public function testCompleteAuth() {
276
296
];
277
297
new Authenticator (
278
298
"test-key " ,
299
+ "example.com " ,
279
300
$ currentUri ,
280
301
AuthUri::DEFAULT_BASE_URI ,
281
302
null ,
@@ -303,6 +324,7 @@ public function testCompleteAuthNotAffectedByQueryString() {
303
324
304
325
new Authenticator (
305
326
"test-key " ,
327
+ "example.com " ,
306
328
"/example-path?filter=something " ,
307
329
AuthUri::DEFAULT_BASE_URI ,
308
330
null ,
0 commit comments