public function it_should_throw_on_delete_if_got_unexpected_response(HttpClient $client) { $client->delete('News/Delete', ['feedId' => $this->getPrimaryKeyValue()])->shouldBeCalled()->willReturn(Helper::trueResponse()); $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringDelete(); $client->delete('News/Delete', ['feedId' => $this->getPrimaryKeyValue()])->shouldBeCalled()->willReturn(Helper::internalServerErrorResponse()); $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringDelete(); }
public function it_should_return_false_if_news_doesnt_exist_on_id(HttpClient $client, Container $ioc) { $id = 3; $criteria = ['Id' => $id]; $caseSensitive = true; $options = ['$filter' => $this->criteriaToFilter($criteria, $caseSensitive), '$skip' => 0, '$top' => 1]; $client->get('News/Get', $options)->shouldBeCalled()->willReturn(Helper::emptyArrayResponse()); $ioc->make($this->fqnModel())->shouldNotBeCalled(); $this->has($id)->shouldReturn(false); }
public function it_returns_false_if_host_doesnt_exist(HttpClient $client, Container $ioc) { $id = 1; $client->get('Hosts/Get/' . $id)->shouldBeCalled()->willReturn(Helper::nullResponse()); $ioc->make($this->fqnModel())->shouldNotBeCalled(); $this->has($id)->shouldReturn(false); }
public function it_should_throw_on_get_free_state_if_got_unexpected_response(HttpClient $client) { $client->get('Sessions/GetActive')->shouldBeCalled()->willReturn(Helper::trueResponse()); $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringIsFree(); }
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); }
public function it_should_throw_on_has_loginname_if_got_unexpected_response(HttpClient $client) { $loginName = '*****@*****.**'; $client->get('Users/LoginNameExist', ['loginName' => $loginName])->shouldBeCalled()->willReturn(Helper::emptyArrayResponse()); $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringhasLoginName($loginName); $client->get('Users/LoginNameExist', ['loginName' => $loginName])->shouldBeCalled()->willReturn(Helper::internalServerErrorResponse()); $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringhasLoginName($loginName); }
public function it_should_throw_on_get_settings_if_got_unexpected_response(HttpClient $client) { $client->get('Service/Settings')->shouldBeCalled()->willReturn(Helper::trueResponse()); $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringGetSettings(); $client->get('Service/Settings')->shouldBeCalled()->willReturn(Helper::internalServerErrorResponse()); $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringGetSettings(); }
public function it_should_throw_on_has_if_got_unexpected_response(HttpClient $client) { $id = 2; $options = ['$filter' => $this->criteriaToFilter(['Id' => $id]), '$skip' => 0, '$top' => 1]; $client->get('Sessions/Get', $options)->shouldBeCalled()->willReturn(Helper::trueResponse()); $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringHas($id); $client->get('Sessions/Get', $options)->shouldBeCalled()->willReturn(Helper::internalServerErrorResponse()); $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringHas($id); }