Test Failed
Push — master ( 99cade...32f37c )
by Dan Michael O.
10:15
created

RequestedResourcesSpec   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A it_provides_filtering_options() 0 22 1
1
<?php
2
3
namespace spec\Scriptotek\Alma\TaskLists;
4
5
use Scriptotek\Alma\Bibs\Bib;
6
use Scriptotek\Alma\Bibs\Bibs;
7
use Scriptotek\Alma\Client as AlmaClient;
8
use Scriptotek\Alma\Conf\Library;
9
use Scriptotek\Alma\TaskLists\RequestedResource;
10
use PhpSpec\ObjectBehavior;
11
use Prophecy\Argument;
12
use spec\Scriptotek\Alma\SpecHelper;
13
14
class RequestedResourcesSpec extends ObjectBehavior
15
{
16
    function it_provides_filtering_options(AlmaClient $client, Library $library, Bibs $bibs, Bib $bib)
17
    {
18
        $library->code = 'SOME_LIBRARY';
19
        $this->beConstructedWith($client, $library, 'DEFAULT_CIRC_DESK', [
20
            'printed' => 'N',
21
        ]);
22
23
        $client->bibs = $bibs;
24
        $bibs->get('991120800814702204')
25
            ->shouldBeCalled()
26
            ->willReturn($bib);
27
28
        $client->getJSON('/task-lists/requested-resources?printed=N&library=SOME_LIBRARY&circ_desk=DEFAULT_CIRC_DESK&offset=0&limit=10')
29
            ->shouldBeCalled()
30
            ->willReturn(SpecHelper::getDummyData('requested-resources_response.json'));
31
32
        $result = $this->all();
33
34
        $result->shouldBeArray();
35
        $result->shouldHaveCount(1);
36
        $result[0]->shouldBeAnInstanceOf(RequestedResource::class);
37
    }
38
}
39