Skip to content

Commit 58f97af

Browse files
authored
Merge pull request #411 from cakephp/persist-identity
Remove unneeded check and update testcase.
2 parents f508283 + dd5e77e commit 58f97af

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/AuthenticationService.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,7 @@ public function persistIdentity(ServerRequestInterface $request, ResponseInterfa
247247
}
248248
}
249249

250-
if (!($identity instanceof IdentityInterface)) {
251-
$identity = $this->buildIdentity($identity);
252-
}
250+
$identity = $this->buildIdentity($identity);
253251

254252
return [
255253
'request' => $request->withAttribute($this->getConfig('identityAttribute'), $identity),

tests/TestCase/AuthenticationServiceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,13 @@ public function testPersistIdentityInterface()
396396
{
397397
$request = new ServerRequest();
398398
$response = new Response();
399-
$identity = $this->createMock(IdentityInterface::class);
399+
$identity = new ArrayObject();
400400

401401
$service = new AuthenticationService();
402402

403403
$result = $service->persistIdentity($request, $response, $identity);
404404

405-
$this->assertSame($identity, $result['request']->getAttribute('identity'));
405+
$this->assertInstanceOf(IdentityInterface::class, $result['request']->getAttribute('identity'));
406406
}
407407

408408
/**

0 commit comments

Comments
 (0)