Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 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();
 }
Esempio n. 5
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);
 }
Esempio n. 6
0
 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);
 }
Esempio n. 7
0
 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();
 }
Esempio n. 8
0
 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);
 }