Code Duplication    Length = 28-29 lines in 2 locations

spec/Conf/JobsSpec.php 1 location

@@ 11-38 (lines=28) @@
8
use Scriptotek\Alma\Conf\Job;
9
use spec\Scriptotek\Alma\SpecHelper;
10
11
class JobsSpec extends ObjectBehavior
12
{
13
    public function let(AlmaClient $client)
14
    {
15
        $this->beConstructedWith($client);
16
    }
17
18
    public function it_provides_a_lazy_interface_to_job_objects(AlmaClient $client)
19
    {
20
        SpecHelper::expectNoRequests($client);
21
22
        $job_id = 'M26714670000011';
23
        $job = $this->get($job_id);
24
25
        $job->shouldBeAnInstanceOf(Job::class);
26
        $job->job_id->shouldBe($job_id);
27
    }
28
29
    public function it_provides_jobs(AlmaClient $client)
30
    {
31
        $client->getJSON(Argument::containingString('/conf/jobs?'))
32
            ->shouldBeCalled()
33
            ->willReturn(SpecHelper::getDummyData('jobs_response.json'));
34
35
        $this->all()->shouldBeArray();
36
        $this->all()[0]->shouldBeAnInstanceOf(Job::class);
37
    }
38
}
39

spec/Conf/LocationsSpec.php 1 location

@@ 11-39 (lines=29) @@
8
use Scriptotek\Alma\Conf\Location;
9
use spec\Scriptotek\Alma\SpecHelper;
10
11
class LocationsSpec extends ObjectBehavior
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