Beispiel #1
0
 public function it_should_return_session_repository(Container $ioc, Repositories\SessionRepositoryInterface $repository)
 {
     $this->hasRepository('sessions')->shouldBe(true);
     $ioc->make(Repositories\SessionRepositoryInterface::class)->willReturn($repository);
     $this->sessions->shouldBe($repository);
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
 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);
 }
Beispiel #4
0
 public function it_should_throw_on_get_user_if_got_unexpected_response(HttpClient $client, Container $ioc)
 {
     $id = 2;
     $client->get('Users/Get', ['$filter' => 'Id eq ' . $id, '$skip' => 0, '$top' => 1])->shouldBeCalled()->willReturn(Helper::trueResponse());
     $ioc->make($this->fqnModel())->shouldNotBeCalled();
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringGet($id);
     $client->get('Users/Get', ['$filter' => 'Id eq ' . $id, '$skip' => 0, '$top' => 1])->shouldBeCalled()->willReturn(Helper::internalServerErrorResponse());
     $ioc->make($this->fqnModel())->shouldNotBeCalled();
     $this->shouldThrow('\\Pisa\\GizmoAPI\\Exceptions\\UnexpectedResponseException')->duringGet($id);
 }