| @@ 10-26 (lines=17) @@ | ||
| 7 | use Scriptotek\Alma\Conf\Job; |
|
| 8 | use spec\Scriptotek\Alma\SpecHelper; |
|
| 9 | ||
| 10 | class JobSpec extends ObjectBehavior |
|
| 11 | { |
|
| 12 | public function let(AlmaClient $client) |
|
| 13 | { |
|
| 14 | $this->beConstructedWith($client, 'M26714670000011'); |
|
| 15 | ||
| 16 | $client->getJSON('/conf/jobs/M26714670000011') |
|
| 17 | ->willReturn(SpecHelper::getDummyData('job_response.json')); |
|
| 18 | $client->postJSON('/conf/jobs/M26714670000011?op=run') |
|
| 19 | ->willReturn(SpecHelper::getDummyData('job_response.json')); |
|
| 20 | } |
|
| 21 | ||
| 22 | public function it_is_initializable() |
|
| 23 | { |
|
| 24 | $this->shouldHaveType(Job::class); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 10-29 (lines=20) @@ | ||
| 7 | use Scriptotek\Alma\Electronic\Collection; |
|
| 8 | use spec\Scriptotek\Alma\SpecHelper; |
|
| 9 | ||
| 10 | class CollectionSpec extends ObjectBehavior |
|
| 11 | { |
|
| 12 | public function let(AlmaClient $client) |
|
| 13 | { |
|
| 14 | $collection_id = '123'; |
|
| 15 | $this->beConstructedWith($client, $collection_id); |
|
| 16 | } |
|
| 17 | ||
| 18 | protected function expectRequest($client) |
|
| 19 | { |
|
| 20 | $client->getJSON('/electronic/e-collections/123') |
|
| 21 | ->shouldBeCalled() |
|
| 22 | ->willReturn(SpecHelper::getDummyData('e-collection_response.json')); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function it_is_initializable() |
|
| 26 | { |
|
| 27 | $this->shouldHaveType(Collection::class); |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||
| @@ 10-31 (lines=22) @@ | ||
| 7 | use Scriptotek\Alma\Users\Requests; |
|
| 8 | use spec\Scriptotek\Alma\SpecHelper; |
|
| 9 | ||
| 10 | class RequestsSpec extends ObjectBehavior |
|
| 11 | { |
|
| 12 | public function let(AlmaClient $client) |
|
| 13 | { |
|
| 14 | $url = '/bibs/1/holdings/2/items/3/requests'; |
|
| 15 | $this->beConstructedWith($client, $url); |
|
| 16 | } |
|
| 17 | ||
| 18 | public function it_is_countable(AlmaClient $client) |
|
| 19 | { |
|
| 20 | $client->getJSON('/bibs/1/holdings/2/items/3/requests') |
|
| 21 | ->shouldBeCalled() |
|
| 22 | ->willReturn(SpecHelper::getDummyData('item_requests_response.json')); |
|
| 23 | ||
| 24 | $this->shouldHaveCount(1); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function it_is_initializable() |
|
| 28 | { |
|
| 29 | $this->shouldHaveType(Requests::class); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||