ElectronicCollectionsSpec::it_is_countable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace spec\Scriptotek\Alma\Bibs;
4
5
use PhpSpec\ObjectBehavior;
6
use Scriptotek\Alma\Bibs\Bib;
7
use Scriptotek\Alma\Bibs\ElectronicCollections;
8
use Scriptotek\Alma\Client as AlmaClient;
9
use Scriptotek\Alma\Electronic\Collection;
10
use spec\Scriptotek\Alma\SpecHelper;
11
12
class ElectronicCollectionsSpec extends ObjectBehavior
13
{
14
    public function let(AlmaClient $client, Bib $bib)
15
    {
16
        $bib->mms_id = 'abc';
17
        $this->beConstructedWith($client, $bib);
18
    }
19
20
    public function it_is_initializable()
21
    {
22
        $this->shouldHaveType(ElectronicCollections::class);
23
    }
24
25
    protected function expectRequest($client)
26
    {
27
        $client->getJSON('/bibs/abc/e-collections')
28
            ->shouldBeCalled()
29
            ->willReturn(SpecHelper::getDummyData('e-collections_response.json'));
30
    }
31
32
    public function it_is_countable(AlmaClient $client)
33
    {
34
        $this->expectRequest($client);
35
36
        $this->shouldHaveCount(1);
37
    }
38
39
    public function it_provides_basic_data_without_loading_the_full_record(AlmaClient $client)
40
    {
41
        $this->expectRequest($client);
42
43
        $c = $this->all()[0];
44
45
        $c->shouldHaveType(Collection::class);
46
        $c->public_name->shouldBe('SpringerLink Books Complete');
47
    }
48
}
49