public function testSignsUserOut()
 {
     $userId = 'ddddd';
     $sessionToken = 'sssss';
     $request = new SignOutRequest($userId, $sessionToken);
     $this->server->SetRequest($request);
     $this->authentication->expects($this->once())->method('Logout')->with($this->equalTo($userId), $this->equalTo($sessionToken));
     $this->service->SignOut($this->server);
 }
 public function testFailedUpdate()
 {
     $userId = 123;
     $userRequest = new UpdateUserRequest();
     $this->server->SetRequest($userRequest);
     $errors = array('error');
     $controllerResult = new UserControllerResult(null, $errors);
     $this->controller->expects($this->once())->method('Update')->with($this->equalTo($userId), $this->equalTo($userRequest), $this->equalTo($this->server->GetSession()))->will($this->returnValue($controllerResult));
     $this->service->Update($userId);
     $this->assertEquals(new FailedResponse($this->server, $errors), $this->server->_LastResponse);
     $this->assertEquals(RestResponse::BAD_REQUEST_CODE, $this->server->_LastResponseCode);
 }
 public function testWhenUpdateValidationFails()
 {
     $referenceNumber = '123';
     $reservationRequest = new ReservationRequest();
     $this->server->SetRequest($reservationRequest);
     $errors = array('error');
     $controllerResult = new ReservationControllerResult($referenceNumber);
     $controllerResult->SetErrors($errors);
     $this->controller->expects($this->once())->method('Update')->with($this->anything(), $this->anything(), $this->anything(), $this->anything())->will($this->returnValue($controllerResult));
     $this->service->Update($referenceNumber);
     $expectedResponse = new FailedResponse($this->server, $errors);
     $this->assertEquals($expectedResponse, $this->server->_LastResponse);
     $this->assertEquals(RestResponse::BAD_REQUEST_CODE, $this->server->_LastResponseCode);
 }