Exemple #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();
 }
 public function it_should_throw_on_findby_if_got_unexpected_response(HttpClient $client, Container $ioc)
 {
     $criteria = ['Title' => 'Foo'];
     $caseSensitive = false;
     $options = ['$filter' => $this->criteriaToFilter($criteria, $caseSensitive), '$skip' => self::$skip, '$top' => self::$top, '$orderby' => self::$orderby];
     $client->get('News/Get', $options)->shouldBeCalled()->willReturn(Helper::internalServerErrorResponse());
     $ioc->make($this->fqnModel())->shouldNotBeCalled();
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringFindBy($criteria, $caseSensitive, self::$top, self::$skip, self::$orderby);
     $client->get('News/Get', $options)->shouldBeCalled()->willReturn(Helper::trueResponse());
     $ioc->make($this->fqnModel())->shouldNotBeCalled();
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringFindBy($criteria, $caseSensitive, self::$top, self::$skip, self::$orderby);
 }
 public function it_throws_on_get_host_by_number_if_got_unexpected_response(HttpClient $client)
 {
     $no = 1;
     $client->get('Hosts/GetByNumber', ['hostNumber' => $no])->shouldBeCalled()->willReturn(Helper::trueResponse());
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringGetByNumber($no);
 }
Exemple #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();
 }
Exemple #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);
 }
 public function it_should_check_if_loginname_exists(HttpClient $client)
 {
     $loginName = '*****@*****.**';
     $client->get('Users/LoginNameExist', ['loginName' => $loginName])->shouldBeCalled()->willReturn(Helper::trueResponse());
     $this->hasLoginName($loginName)->shouldReturn(true);
     $client->get('Users/LoginNameExist', ['loginName' => $loginName])->shouldBeCalled()->willReturn(Helper::falseResponse());
     $this->hasLoginName($loginName)->shouldReturn(false);
 }
 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);
 }