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_empty_array_if_no_host_found_by_number(HttpClient $client, Container $ioc, Host $host) { $no = 1; $client->get('Hosts/GetByNumber', ['hostNumber' => $no])->shouldBeCalled()->willReturn(Helper::emptyArrayResponse()); $ioc->make($this->fqnModel())->shouldNotBeCalled(); $this->getByNumber($no)->shouldBeArray(); $this->getByNumber($no)->shouldHaveCount(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); }
public function it_should_get_free_state(HttpClient $client) { $client->get('Sessions/GetActive')->shouldBeCalled()->willReturn(Helper::contentResponse([['HostId' => $this->getPrimaryKeyValue()->getWrappedObject()]])); $this->isFree()->shouldReturn(false); $client->get('Sessions/GetActive')->shouldBeCalled()->willReturn(Helper::emptyArrayResponse()); $this->isFree()->shouldReturn(true); }
public function it_should_check_if_session_exists(HttpClient $client) { $id = 2; $options = ['$filter' => $this->criteriaToFilter(['Id' => $id]), '$skip' => 0, '$top' => 1]; $client->get('Sessions/Get', $options)->shouldBeCalled()->willReturn(Helper::contentResponse([Helper::fakeSession()])); $this->has($id)->shouldReturn(true); $client->get('Sessions/Get', $options)->shouldBeCalled()->willReturn(Helper::emptyArrayResponse()); $this->has($id)->shouldReturn(false); }