public function testReadOwnerFromAccessToken()
 {
     $token = new AccessToken();
     $owner = $this->getMock(TokenOwnerInterface::class);
     $token->setOwner($owner);
     $this->resourceServer->expects($this->atLeastOnce())->method('getAccessToken')->with($this->isInstanceOf(ServerRequestInterface::class))->will($this->returnValue($token));
     $this->assertFalse($this->storage->isEmpty());
     $this->assertSame($owner, $this->storage->read());
 }
 public function testFailAuthenticationOnExpiredToken()
 {
     $token = new AccessToken();
     $owner = $this->getMock(TokenOwnerInterface::class);
     $token->setOwner($owner);
     $this->resourceServer->expects($this->atLeastOnce())->method('getAccessToken')->with($this->isInstanceOf(PsrServerRequestInterface::class))->will($this->throwException(new OAuth2Exception('Expired token', 123)));
     $this->setExpectedException(OAuth2Exception::class, 'Expired token', 123);
     $this->authenticationService->getIdentity();
 }