public function testIsAuthenticationValidInvalidCredentials() { $that = $this; $request = $this->createMockRequest(function ($request) use($that) { return $that->throwException(ClientErrorResponseException::factory($request, $that->createClientErrorResponse(400))); }); $this->getMockHttpClient()->expects($this->once())->method('post')->will($this->returnValue($request)); $this->assertFalse($this->resource->isAuthenticationValid('foo', 'bar')); }
public function testGetUserByUsernameNotFound() { $that = $this; $this->getMockHttpClient()->expects($this->once())->method('get')->will($this->returnValue($this->createMockRequest(function ($request) use($that) { return $that->throwException(ClientErrorResponseException::factory($request, $that->createClientErrorResponse(404))); }))); $this->setExpectedException('Seiffert\\CrowdRestBundle\\Exception\\UserNotFoundException'); $this->resource->getUserByUsername('test'); }