LocationsSpec::let()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 5
loc 5
rs 10
c 0
b 0
f 0
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\Library;
8
use Scriptotek\Alma\Conf\Location;
9
use spec\Scriptotek\Alma\SpecHelper;
10
11 View Code Duplication
class LocationsSpec extends ObjectBehavior
0 ignored issues
show
Duplication introduced by
This class 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...
12
{
13
    public function let(AlmaClient $client, Library $library)
14
    {
15
        $library->code = 'LIB_CODE';
16
        $this->beConstructedWith($client, $library);
17
    }
18
19
    public function it_provides_a_lazy_interface_to_location_objects(AlmaClient $client)
20
    {
21
        SpecHelper::expectNoRequests($client);
22
23
        $code = 'LOC_CODE';
24
        $location = $this->get($code);
25
26
        $location->shouldBeAnInstanceOf(Location::class);
27
        $location->code->shouldBe($code);
28
    }
29
30
    public function it_provides_locations(AlmaClient $client)
31
    {
32
        $client->getJSON('/conf/libraries/LIB_CODE/locations')
33
            ->shouldBeCalled()
34
            ->willReturn(SpecHelper::getDummyData('locations_response.json'));
35
36
        $this->all()->shouldBeArray();
37
        $this->all()[0]->shouldBeAnInstanceOf(Location::class);
38
    }
39
}
40