public function testRegisterClient() { $this->clientRepository->expects($this->once())->method('idExists')->willReturn(false); $this->clientRepository->expects($this->once())->method('save')->will($this->returnArgument(0)); list($client, $secret) = $this->clientService->registerClient('name', ['http://www.example.com']); $this->assertEquals(60, strlen($client->getSecret())); $this->assertEquals(40, strlen($secret)); }
public function testRegisterClient() { $client = new Client(); $this->clientRepository->expects($this->once())->method('save')->with($client)->willReturn($client); list($client, $secret) = $this->clientService->registerClient($client); $this->assertEquals(60, strlen($client->getSecret())); $this->assertEquals(40, strlen($secret)); $this->assertFalse($this->clientService->authenticate($client, 'azerty')); $this->assertTrue($this->clientService->authenticate($client, $secret)); $this->assertFalse($this->clientService->authenticate($client, $client->getSecret())); }