@@ 26-42 (lines=17) @@ | ||
23 | $this->shouldHaveType(Loans::class); |
|
24 | } |
|
25 | ||
26 | public function it_yields_loans(AlmaClient $client, UriInterface $url) |
|
27 | { |
|
28 | $client->buildUrl('/users/123435/loans', ['offset' => 0, 'limit' => 10]) |
|
29 | ->shouldBeCalled() |
|
30 | ->willReturn($url); |
|
31 | ||
32 | $client->getJSON($url) |
|
33 | ->shouldBeCalled() |
|
34 | ->willReturn(SpecHelper::getDummyData('loans_response.json')); |
|
35 | ||
36 | ||
37 | $this->rewind(); |
|
38 | $this->valid()->shouldBe(true); |
|
39 | $this->current()->shouldBeAnInstanceOf(Loan::class); |
|
40 | ||
41 | $this->shouldHaveCount(2); |
|
42 | } |
|
43 | ||
44 | public function it_can_be_empty(AlmaClient $client, UriInterface $url) |
|
45 | { |
|
@@ 44-58 (lines=15) @@ | ||
41 | $this->shouldHaveCount(2); |
|
42 | } |
|
43 | ||
44 | public function it_can_be_empty(AlmaClient $client, UriInterface $url) |
|
45 | { |
|
46 | $client->buildUrl('/users/123435/loans', ['offset' => 0, 'limit' => 10]) |
|
47 | ->shouldBeCalled() |
|
48 | ->willReturn($url); |
|
49 | ||
50 | $client->getJSON($url) |
|
51 | ->shouldBeCalled() |
|
52 | ->willReturn(SpecHelper::getDummyData('zero_loans_response.json')); |
|
53 | ||
54 | $this->rewind(); |
|
55 | $this->valid()->shouldBe(false); |
|
56 | ||
57 | $this->shouldHaveCount(0); |
|
58 | } |
|
59 | } |
|
60 |