getMock(ClientRepositoryInterface::class), $this->getMock(AccessTokenRepositoryInterface::class), $this->getMock(ScopeRepositoryInterface::class), '', '', new StubResponseType() ); $server->enableGrantType(new ClientCredentialsGrant(), new \DateInterval('PT1M')); $response = $server->respondToRequest(); $this->assertTrue($response instanceof ResponseInterface); $this->assertEquals(400, $response->getStatusCode()); } public function testRespondToRequest() { $clientRepository = $this->getMock(ClientRepositoryInterface::class); $clientRepository->method('getClientEntity')->willReturn(new ClientEntity()); $server = new Server( $clientRepository, $this->getMock(AccessTokenRepositoryInterface::class), $this->getMock(ScopeRepositoryInterface::class), '', '', new StubResponseType() ); $server->enableGrantType(new ClientCredentialsGrant(), new \DateInterval('PT1M')); $_POST['grant_type'] = 'client_credentials'; $_POST['client_id'] = 'foo'; $_POST['client_secret'] = 'bar'; $response = $server->respondToRequest(); $this->assertEquals(200, $response->getStatusCode()); } }