File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
tests/TestCase/Authenticator Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,34 @@ public function testAuthenticateSuccessWithoutCollectionButObject()
148148 $ this ->assertSame (Result::SUCCESS , $ result ->getStatus ());
149149 }
150150
151+ /**
152+ * Test authentication
153+ *
154+ * @return void
155+ */
156+ public function testAuthenticateSuccessWithDirectCollection ()
157+ {
158+ $ request = ServerRequestFactory::fromGlobals (['REQUEST_URI ' => '/ ' ]);
159+
160+ $ this ->sessionMock ->expects ($ this ->once ())
161+ ->method ('read ' )
162+ ->with ('Auth ' )
163+ ->willReturn ([
164+ 'username ' => 'mariano ' ,
165+ 'password ' => 'password ' ,
166+ ]);
167+
168+ $ request = $ request ->withAttribute ('session ' , $ this ->sessionMock );
169+
170+ $ authenticator = new SessionAuthenticator (new IdentifierCollection (), [
171+ 'identifier ' => new IdentifierCollection (['Authentication.Password ' ]),
172+ ]);
173+ $ result = $ authenticator ->authenticate ($ request );
174+
175+ $ this ->assertInstanceOf (Result::class, $ result );
176+ $ this ->assertSame (Result::SUCCESS , $ result ->getStatus ());
177+ }
178+
151179 /**
152180 * Test authentication
153181 *
You can’t perform that action at this time.
0 commit comments