コード例 #1
0
ファイル: NewsSpec.php プロジェクト: Zachu/GizmoAPI
 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
ファイル: NewsRepositorySpec.php プロジェクト: Zachu/GizmoAPI
 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);
 }
コード例 #3
0
ファイル: HostRepositorySpec.php プロジェクト: Zachu/GizmoAPI
 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);
 }
コード例 #4
0
ファイル: HostSpec.php プロジェクト: Zachu/GizmoAPI
 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();
 }
コード例 #5
0
ファイル: UserSpec.php プロジェクト: Zachu/GizmoAPI
 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);
 }
コード例 #6
0
ファイル: UserRepositorySpec.php プロジェクト: Zachu/GizmoAPI
 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);
 }
コード例 #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();
 }
コード例 #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);
 }