88use Authwave \ProviderUri \LoginUri ;
99use Authwave \ProviderUri \LogoutUri ;
1010use Authwave \RedirectHandler ;
11+ use Authwave \ResponseData \AbstractResponseData ;
1112use Authwave \SessionData ;
1213use Authwave \SessionNotStartedException ;
1314use Authwave \Token ;
14- use Authwave \UserData ;
15+ use Authwave \ResponseData \ UserData ;
1516use PHPUnit \Framework \TestCase ;
1617use Psr \Http \Message \UriInterface ;
1718
@@ -49,7 +50,7 @@ public function testIsLoggedInTrueWhenSessionDataSet() {
4950 $ userData = self ::createMock (UserData::class);
5051 $ sessionData = self ::createMock (SessionData::class);
5152 $ sessionData ->expects (self ::once ())
52- ->method ("getUserData " )
53+ ->method ("getData " )
5354 ->willReturn ($ userData );
5455
5556 $ _SESSION = [
@@ -63,7 +64,10 @@ public function testIsLoggedInTrueWhenSessionDataSet() {
6364 self ::assertTrue ($ sut ->isLoggedIn ());
6465 }
6566
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 () {
6771 $ sessionData = self ::createMock (SessionData::class);
6872 $ _SESSION = [
6973 Authenticator::SESSION_KEY => $ sessionData
@@ -146,7 +150,7 @@ public function testLoginRedirectsWithCorrectQueryString() {
146150 $ expectedQueryParts = [
147151 LoginUri::QUERY_STRING_CIPHER => $ cipher ,
148152 LoginUri::QUERY_STRING_INIT_VECTOR => $ ivString ,
149- LoginUri::QUERY_STRING_CURRENT_PATH => $ currentPath ,
153+ LoginUri::QUERY_STRING_CURRENT_PATH => bin2hex ( $ currentPath) ,
150154 ];
151155 $ expectedQuery = http_build_query ($ expectedQueryParts );
152156
@@ -205,7 +209,7 @@ public function testGetUuid() {
205209 $ userData ->method ("getUuid " )
206210 ->willReturn ($ expectedUuid );
207211 $ sessionData = self ::createMock (SessionData::class);
208- $ sessionData ->method ("getUserData " )
212+ $ sessionData ->method ("getData " )
209213 ->willReturn ($ userData );
210214
211215 $ _SESSION = [
@@ -235,7 +239,7 @@ public function testGetEmail() {
235239 $ userData ->method ("getEmail " )
236240 ->willReturn ($ expectedEmail );
237241 $ sessionData = self ::createMock (SessionData::class);
238- $ sessionData ->method ("getUserData " )
242+ $ sessionData ->method ("getData " )
239243 ->willReturn ($ userData );
240244
241245 $ _SESSION = [
@@ -303,8 +307,8 @@ public function testCompleteAuth() {
303307 $ newSessionData
304308 );
305309 self ::assertInstanceOf (
306- UserData ::class,
307- $ newSessionData ->getUserData ()
310+ AbstractResponseData ::class,
311+ $ newSessionData ->getData ()
308312 );
309313 }
310314
0 commit comments