Completed
Push — master ( 804c7f...1d2ba7 )
by Dan Michael O.
01:59
created

ElectronicCollectionsSpec::expectRequest()   A

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