8
8
use Authwave \ProviderUri \LoginUri ;
9
9
use Authwave \ProviderUri \LogoutUri ;
10
10
use Authwave \RedirectHandler ;
11
+ use Authwave \ResponseData \AbstractResponseData ;
11
12
use Authwave \SessionData ;
12
13
use Authwave \SessionNotStartedException ;
13
14
use Authwave \Token ;
14
- use Authwave \UserData ;
15
+ use Authwave \ResponseData \ UserData ;
15
16
use PHPUnit \Framework \TestCase ;
16
17
use Psr \Http \Message \UriInterface ;
17
18
@@ -49,7 +50,7 @@ public function testIsLoggedInTrueWhenSessionDataSet() {
49
50
$ userData = self ::createMock (UserData::class);
50
51
$ sessionData = self ::createMock (SessionData::class);
51
52
$ sessionData ->expects (self ::once ())
52
- ->method ("getUserData " )
53
+ ->method ("getData " )
53
54
->willReturn ($ userData );
54
55
55
56
$ _SESSION = [
@@ -63,7 +64,10 @@ public function testIsLoggedInTrueWhenSessionDataSet() {
63
64
self ::assertTrue ($ sut ->isLoggedIn ());
64
65
}
65
66
66
- public function testLogoutClearsSession () {
67
+ // TODO: Session shouldn't be cleared on call to logout - instead it should
68
+ // redirect to the provider, and a new test should asset the response data
69
+ // contains a logout confirmation.
70
+ public function TODO_UPDATE_testLogoutClearsSession () {
67
71
$ sessionData = self ::createMock (SessionData::class);
68
72
$ _SESSION = [
69
73
Authenticator::SESSION_KEY => $ sessionData
@@ -146,7 +150,7 @@ public function testLoginRedirectsWithCorrectQueryString() {
146
150
$ expectedQueryParts = [
147
151
LoginUri::QUERY_STRING_CIPHER => $ cipher ,
148
152
LoginUri::QUERY_STRING_INIT_VECTOR => $ ivString ,
149
- LoginUri::QUERY_STRING_CURRENT_PATH => $ currentPath ,
153
+ LoginUri::QUERY_STRING_CURRENT_PATH => bin2hex ( $ currentPath) ,
150
154
];
151
155
$ expectedQuery = http_build_query ($ expectedQueryParts );
152
156
@@ -205,7 +209,7 @@ public function testGetUuid() {
205
209
$ userData ->method ("getUuid " )
206
210
->willReturn ($ expectedUuid );
207
211
$ sessionData = self ::createMock (SessionData::class);
208
- $ sessionData ->method ("getUserData " )
212
+ $ sessionData ->method ("getData " )
209
213
->willReturn ($ userData );
210
214
211
215
$ _SESSION = [
@@ -235,7 +239,7 @@ public function testGetEmail() {
235
239
$ userData ->method ("getEmail " )
236
240
->willReturn ($ expectedEmail );
237
241
$ sessionData = self ::createMock (SessionData::class);
238
- $ sessionData ->method ("getUserData " )
242
+ $ sessionData ->method ("getData " )
239
243
->willReturn ($ userData );
240
244
241
245
$ _SESSION = [
@@ -303,8 +307,8 @@ public function testCompleteAuth() {
303
307
$ newSessionData
304
308
);
305
309
self ::assertInstanceOf (
306
- UserData ::class,
307
- $ newSessionData ->getUserData ()
310
+ AbstractResponseData ::class,
311
+ $ newSessionData ->getData ()
308
312
);
309
313
}
310
314
0 commit comments