Ejemplo n.º 1
0
 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'));
 }
Ejemplo n.º 2
0
 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');
 }