Пример #1
0
 public function it_should_throw_on_update_if_got_unexpected_response(HttpClient $client)
 {
     $this->Title = 'NewTitle';
     $client->post('News/Update', $this->getAttributes())->shouldBeCalled()->willReturn(Helper::trueResponse());
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringSave();
     $client->post('News/Update', $this->getAttributes())->shouldBeCalled()->willReturn(Helper::internalServerErrorResponse());
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringSave();
 }
Пример #2
0
 public function it_should_throw_on_out_of_order_if_got_unexpected_response(HttpClient $client)
 {
     $client->post("Host/SetOrderState", ['hostId' => $this->getPrimaryKeyValue(), 'inOrder' => "false"])->shouldBeCalled()->willReturn(Helper::trueResponse());
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringSetOrderState(true);
 }
Пример #3
0
 public function it_should_throw_on_set_user_group_when_got_unexpected_reply(HttpClient $client)
 {
     $newUserGroup = $this->getAttribute('GroupId')->getWrappedObject() + 1;
     $client->post('Users/SetUserGroup', ['userId' => $this->getPrimaryKeyValue(), 'newUserGroup' => $newUserGroup])->shouldBeCalled()->willReturn(Helper::trueResponse());
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringSetUserGroup($newUserGroup);
     $this->GroupId->shouldNotBe($newUserGroup);
 }