public function it_should_return_true_if_news_exist_on_id(HttpClient $client, Container $ioc, NewsInterface $news)
 {
     $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::contentResponse([Helper::fakeNews(['Id' => $id])]));
     $ioc->make($this->fqnModel())->shouldBeCalled()->willReturn($news);
     $this->has($id)->shouldReturn(true);
 }
 public function it_return_true_if_host_exists(HttpClient $client, Container $ioc, Host $host)
 {
     $id = 1;
     $client->get('Hosts/Get/' . $id)->shouldBeCalled()->willReturn(Helper::contentResponse([Helper::fakeHost(), Helper::fakeHost()]));
     $ioc->make($this->fqnModel())->shouldBeCalled()->willReturn($host);
     $this->has($id)->shouldReturn(true);
 }
 public function it_should_get_user(HttpClient $client, Container $ioc, User $user)
 {
     $id = 2;
     $client->get('Users/Get', ['$filter' => 'Id eq ' . $id, '$skip' => 0, '$top' => 1])->shouldBeCalled()->willReturn(Helper::contentResponse([['Id' => $id]]));
     $ioc->make($this->fqnModel())->shouldBeCalled()->willReturn($user);
     $this->get($id)->shouldBe($user);
 }
Exemple #4
0
 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);
 }