Пример #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();
 }
Пример #2
0
 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);
 }
Пример #3
0
 public function it_should_throw_on_create_process_on_unexpected_response(HttpClient $client)
 {
     $startInfo = ['FileName' => 'foo'];
     $client->post("Host/CreateProcess", array_merge($startInfo, ['hostId' => $this->getPrimaryKeyValue()]))->shouldBeCalled()->willReturn(Helper::trueResponse());
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringCreateProcess($startInfo);
     $client->post("Host/CreateProcess", array_merge($startInfo, ['hostId' => $this->getPrimaryKeyValue()]))->shouldBeCalled()->willReturn(Helper::internalServerErrorResponse());
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringCreateProcess($startInfo);
 }
Пример #4
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);
 }
Пример #5
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();
 }
Пример #6
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);
 }