public function testCanCreateTokenResponse() { $request = $this->getMock(ServerRequestInterface::class); $client = new Client(); $owner = $this->getMock(TokenOwnerInterface::class); $owner->expects($this->once())->method('getTokenOwnerId')->will($this->returnValue(1)); $token = new AccessToken(); $token->setToken('azerty'); $token->setOwner($owner); $token->setExpiresAt((new DateTime())->add(new DateInterval('PT1H'))); $this->tokenService->expects($this->once())->method('createToken')->will($this->returnValue($token)); $response = $this->grant->createTokenResponse($request, $client, $owner); $body = json_decode($response->getBody(), true); $this->assertEquals('azerty', $body['access_token']); $this->assertEquals('Bearer', $body['token_type']); $this->assertEquals(3600, $body['expires_in']); $this->assertEquals(1, $body['owner_id']); }
public function testMethodAllowPublicClients() { $this->assertFalse($this->grant->allowPublicClients()); }