Test Failed
Push — master ( c6b6d3...528954 )
by Dan Michael O.
03:21
created

LibrariesSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace spec\Scriptotek\Alma\Conf;
4
5
use Psr\Http\Message\UriInterface;
6
use Scriptotek\Alma\Client as AlmaClient;
7
use Scriptotek\Alma\Conf\Libraries;
8
use Scriptotek\Alma\Conf\Library;
9
use PhpSpec\ObjectBehavior;
10
use spec\Scriptotek\Alma\SpecHelper;
11
12
class LibrariesSpec extends ObjectBehavior
13
{
14
    public function let(AlmaClient $client)
15
    {
16
        $this->beConstructedWith($client);
17
    }
18
19
    function it_is_muh()
20
    {
21
        $this->shouldBeAnInstanceOf(Libraries::class);
22
        $this->shouldImplement(\Countable::class);
23
        $this->shouldImplement(\Iterator::class);
24
    }
25
26 View Code Duplication
    function it_provides_a_lazy_interface_to_libary_objects(AlmaClient $client)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
    {
28
        SpecHelper::expectNoRequests($client);
29
30
        $libraryCode = 'THAT_LIBRARY';
31
        $library = $this->get($libraryCode);
32
33
        $library->shouldBeAnInstanceOf(Library::class);
34
        $library->code->shouldBe($libraryCode);
35
    }
36
37 View Code Duplication
    function it_provides_libraries(AlmaClient $client, UriInterface $url)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38
    {
39
        $client->buildUrl('/conf/libraries', [])
40
            ->shouldBeCalled()
41
            ->willReturn($url);
42
43
        $client->getJSON($url)
44
            ->shouldBeCalled()
45
            ->willReturn(SpecHelper::getDummyData('libraries_response.json'));
46
47
        $this->shouldHaveCount(27);
48
        $this->all()->shouldBeArray();
49
        $this->all()[0]->shouldBeAnInstanceOf(Library::class);
50
    }
51
}
52