JobInstancesSpec::let()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
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\Job;
8
use Scriptotek\Alma\Conf\JobInstance;
9
use spec\Scriptotek\Alma\SpecHelper;
10
11
class JobInstancesSpec extends ObjectBehavior
12
{
13
    public function let(AlmaClient $client, Job $job)
14
    {
15
        $job->job_id = '1108569450000121';
16
        $this->beConstructedWith($client, $job);
17
    }
18
19
    public function it_provides_a_lazy_interface_to_jobinstance_objects(AlmaClient $client)
20
    {
21
        SpecHelper::expectNoRequests($client);
22
23
        $jobId = '1108569450000121';
0 ignored issues
show
Unused Code introduced by
$jobId is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
24
        $instanceId = '1108569450000121';
25
        $jobInstance = $this->get($instanceId);
26
        $jobInstance->shouldBeAnInstanceOf(JobInstance::class);
27
    }
28
29
    public function it_provides_job_instances(AlmaClient $client)
30
    {
31
        $jobId = '1108569450000121';
32
        $client->getJSON("/conf/jobs/{$jobId}/instances?offset=0&limit=10")
33
            ->shouldBeCalled()
34
            ->willReturn(SpecHelper::getDummyData('jobinstances_response.json'));
35
36
        $this->all()->shouldBeArray();
37
        $this->all()[0]->shouldBeAnInstanceOf(JobInstance::class);
38
    }
39
}
40