LibrariesSpec   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 3

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_muh() 0 6 1
A it_provides_a_lazy_interface_to_libary_objects() 0 10 1
A it_provides_libraries() 0 10 1
1
<?php
2
3
namespace spec\Scriptotek\Alma\Conf;
4
5
use PhpSpec\ObjectBehavior;
6
use Scriptotek\Alma\Client as AlmaClient;
7
use Scriptotek\Alma\Conf\Libraries;
8
use Scriptotek\Alma\Conf\Library;
9
use spec\Scriptotek\Alma\SpecHelper;
10
11
class LibrariesSpec extends ObjectBehavior
12
{
13
    public function let(AlmaClient $client)
14
    {
15
        $this->beConstructedWith($client);
16
    }
17
18
    public function it_is_muh()
19
    {
20
        $this->shouldBeAnInstanceOf(Libraries::class);
21
        $this->shouldImplement(\Countable::class);
22
        $this->shouldImplement(\Iterator::class);
23
    }
24
25
    public function it_provides_a_lazy_interface_to_libary_objects(AlmaClient $client)
26
    {
27
        SpecHelper::expectNoRequests($client);
28
29
        $libraryCode = 'THAT_LIBRARY';
30
        $library = $this->get($libraryCode);
31
32
        $library->shouldBeAnInstanceOf(Library::class);
33
        $library->code->shouldBe($libraryCode);
34
    }
35
36
    public function it_provides_libraries(AlmaClient $client)
37
    {
38
        $client->getJSON('/conf/libraries')
39
            ->shouldBeCalled()
40
            ->willReturn(SpecHelper::getDummyData('libraries_response.json'));
41
42
        $this->shouldHaveCount(27);
43
        $this->all()->shouldBeArray();
44
        $this->all()[0]->shouldBeAnInstanceOf(Library::class);
45
    }
46
}
47