1616class  AuthenticatorTest extends  TestCase {
1717	public  function  testConstructWithDefaultSessionNotStarted () {
1818		self ::expectException (SessionNotStartedException::class);
19- 		new  Authenticator ("test-key " ,"/ " );
19+ 		new  Authenticator (
20+ 			"example-app-id " ,
21+ 			"test-key " ,
22+ 			"/ " 
23+ 		);
2024	}
2125
2226	public  function  testConstructWithDefaultSession () {
2327		$ _SESSION 
24- 		new  Authenticator ("test-key " , "/ " );
28+ 		new  Authenticator (
29+ 			"example-app-id " ,
30+ 			"test-key " ,
31+ 			"/ " 
32+ 		);
2533		self ::assertArrayHasKey (
2634			Authenticator::SESSION_KEY ,
2735			$ _SESSION 
@@ -31,6 +39,7 @@ public function testConstructWithDefaultSession() {
3139	public  function  testIsLoggedInFalseByDefault () {
3240		$ _SESSION 
3341		$ sutnew  Authenticator (
42+ 			"example-app-id " ,
3443			"test-key " ,
3544			"/ " 
3645		);
@@ -49,8 +58,9 @@ public function testIsLoggedInTrueWhenSessionDataSet() {
4958		];
5059
5160		$ sutnew  Authenticator (
61+ 			"example-app-id " ,
5262			"test-key " ,
53- 			"/ " , 
63+ 			"/ " 
5464		);
5565		self ::assertTrue ($ sutisLoggedIn ());
5666	}
@@ -62,8 +72,9 @@ public function testLogoutClearsSession() {
6272		];
6373
6474		$ sutnew  Authenticator (
75+ 			"example-app-id " ,
6576			"test-key " ,
66- 			"/ " , 
77+ 			"/ " 
6778		);
6879		$ sutlogout ();
6980		self ::assertEmpty ($ _SESSION 
@@ -76,13 +87,14 @@ public function testLoginRedirects() {
7687		$ redirectHandlerexpects (self ::once ())
7788			->method ("redirect " )
7889			->with (self ::callback (fn (UriInterface $ uri
79- 				$ urigetHost () === AuthUri::DEFAULT_BASE_URI 
90+ 				$ urigetHost () === AuthUri::DEFAULT_BASE_REMOTE_URI 
8091			));
8192
8293		$ sutnew  Authenticator (
94+ 			"example-app-id " ,
8395			"test-key " ,
8496			"/ " ,
85- 			AuthUri::DEFAULT_BASE_URI ,
97+ 			AuthUri::DEFAULT_BASE_REMOTE_URI ,
8698			null ,
8799			$ redirectHandler
88100		);
@@ -102,6 +114,7 @@ public function testLoginRedirectsLocalhost() {
102114			));
103115
104116		$ sutnew  Authenticator (
117+ 			"example-app-id " ,
105118			"test-key " ,
106119			"/ " ,
107120			"http://localhost:8081 " ,
@@ -117,6 +130,7 @@ public function testLoginRedirectsWithCorrectQueryString() {
117130		$ keyuniqid ("key- " );
118131		$ currentPathuniqid ("/path/ " );
119132
133+ 		$ id"example-app-id " ;
120134		$ cipher"example-cipher " ;
121135		$ ivString"example-iv " ;
122136
@@ -131,6 +145,7 @@ public function testLoginRedirectsWithCorrectQueryString() {
131145			->willReturn ($ iv
132146
133147		$ expectedQueryParts
148+ 			AuthUri::QUERY_STRING_ID  => $ id
134149			AuthUri::QUERY_STRING_CIPHER  => $ cipher
135150			AuthUri::QUERY_STRING_INIT_VECTOR  => $ ivString
136151			AuthUri::QUERY_STRING_CURRENT_PATH  => $ currentPath
@@ -145,9 +160,10 @@ public function testLoginRedirectsWithCorrectQueryString() {
145160			));
146161
147162		$ sutnew  Authenticator (
163+ 			$ id
148164			$ key
149165			$ currentPath
150- 			AuthUri::DEFAULT_BASE_URI ,
166+ 			AuthUri::DEFAULT_BASE_REMOTE_URI ,
151167			null ,
152168			$ redirectHandler
153169		);
@@ -165,9 +181,10 @@ public function testLoginDoesNothingWhenAlreadyLoggedIn() {
165181			->method ("redirect " );
166182
167183		$ sutnew  Authenticator (
184+ 			"example-app-id " ,
168185			"test-key " ,
169186			"/ " ,
170- 			AuthUri::DEFAULT_BASE_URI ,
187+ 			AuthUri::DEFAULT_BASE_REMOTE_URI ,
171188			null ,
172189			$ redirectHandler
173190		);
@@ -178,6 +195,7 @@ public function testLoginDoesNothingWhenAlreadyLoggedIn() {
178195	public  function  testGetUuidThrowsExceptionWhenNotLoggedIn () {
179196		$ _SESSION 
180197		$ sutnew  Authenticator (
198+ 			"example-app-id " ,
181199			"test-key " ,
182200			"/ " 
183201		);
@@ -199,6 +217,7 @@ public function testGetUuid() {
199217			Authenticator::SESSION_KEY  => $ sessionData
200218		];
201219		$ sutnew  Authenticator (
220+ 			"example-app-id " ,
202221			"test-key " ,
203222			"/ " 
204223		);
@@ -208,6 +227,7 @@ public function testGetUuid() {
208227	public  function  testGetEmailThrowsExceptionWhenNotLoggedIn () {
209228		$ _SESSION 
210229		$ sutnew  Authenticator (
230+ 			"example-app-id " ,
211231			"test-key " ,
212232			"/ " 
213233		);
@@ -229,6 +249,7 @@ public function testGetEmail() {
229249			Authenticator::SESSION_KEY  => $ sessionData
230250		];
231251		$ sutnew  Authenticator (
252+ 			"example-app-id " ,
232253			"test-key " ,
233254			"/ " 
234255		);
@@ -243,6 +264,7 @@ public function testCompleteAuthNotLoggedIn() {
243264		$ _SESSION 
244265		self ::expectException (NotLoggedInException::class);
245266		new  Authenticator (
267+ 			"example-app-id " ,
246268			"test-key " ,
247269			$ currentUri
248270		);
@@ -275,9 +297,10 @@ public function testCompleteAuth() {
275297			Authenticator::SESSION_KEY  => $ sessionData
276298		];
277299		new  Authenticator (
300+ 			"example-app-id " ,
278301			"test-key " ,
279302			$ currentUri
280- 			AuthUri::DEFAULT_BASE_URI ,
303+ 			AuthUri::DEFAULT_BASE_REMOTE_URI ,
281304			null ,
282305			$ redirectHandler
283306		);
@@ -302,9 +325,10 @@ public function testCompleteAuthNotAffectedByQueryString() {
302325		$ _SESSION 
303326
304327		new  Authenticator (
328+ 			"example-app-id " ,
305329			"test-key " ,
306330			"/example-path?filter=something " ,
307- 			AuthUri::DEFAULT_BASE_URI ,
331+ 			AuthUri::DEFAULT_BASE_REMOTE_URI ,
308332			null ,
309333			$ redirectHandler
310334		);
0 commit comments