RequestedResourcesSpec   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
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 PhpSpec\ObjectBehavior;
6
use Scriptotek\Alma\Bibs\Bib;
7
use Scriptotek\Alma\Bibs\Bibs;
8
use Scriptotek\Alma\Client as AlmaClient;
9
use Scriptotek\Alma\Conf\Library;
10
use Scriptotek\Alma\TaskLists\RequestedResource;
11
use spec\Scriptotek\Alma\SpecHelper;
12
13
class RequestedResourcesSpec extends ObjectBehavior
14
{
15
    public function it_provides_filtering_options(AlmaClient $client, Library $library, Bibs $bibs, Bib $bib)
16
    {
17
        $library->code = 'SOME_LIBRARY';
18
        $this->beConstructedWith($client, $library, 'DEFAULT_CIRC_DESK', [
19
            'printed' => 'N',
20
        ]);
21
22
        $client->bibs = $bibs;
23
        $bibs->get('991120800814702204')
24
            ->shouldBeCalled()
25
            ->willReturn($bib);
26
27
        $client->getJSON('/task-lists/requested-resources?printed=N&library=SOME_LIBRARY&circ_desk=DEFAULT_CIRC_DESK&offset=0&limit=10')
28
            ->shouldBeCalled()
29
            ->willReturn(SpecHelper::getDummyData('requested-resources_response.json'));
30
31
        $result = $this->all();
32
33
        $result->shouldBeArray();
34
        $result->shouldHaveCount(1);
35
        $result[0]->shouldBeAnInstanceOf(RequestedResource::class);
36
    }
37
}
38