Code Duplication    Length = 20-27 lines in 4 locations

spec/Users/FeeSpec.php 1 location

@@ 11-31 (lines=21) @@
8
use Scriptotek\Alma\Users\User;
9
use spec\Scriptotek\Alma\SpecHelper;
10
11
class FeeSpec extends ObjectBehavior
12
{
13
    public function let(AlmaClient $client, User $user)
14
    {
15
        $fee_id = '123435';
16
        $this->beConstructedWith($client, $user, $fee_id);
17
    }
18
19
    public function it_is_initializable()
20
    {
21
        $this->shouldHaveType(Fee::class);
22
    }
23
24
    public function it_can_exist()
25
    {
26
        $this->init(SpecHelper::getDummyData('fee_response.json'));
27
28
        $this->exists()->shouldBe(true);
29
        $this->balance->shouldBe(750);
30
    }
31
}
32

spec/Users/LoanSpec.php 1 location

@@ 12-31 (lines=20) @@
9
use Scriptotek\Alma\Users\User;
10
use spec\Scriptotek\Alma\SpecHelper;
11
12
class LoanSpec extends ObjectBehavior
13
{
14
    public function let(AlmaClient $client, User $user, Item $item)
15
    {
16
        $loan_id = '123';
17
        $this->beConstructedWith($client, $user, $item, $loan_id);
18
    }
19
20
    public function it_is_initializable()
21
    {
22
        $this->shouldHaveType(Loan::class);
23
    }
24
25
    public function it_can_exist()
26
    {
27
        $this->init(SpecHelper::getDummyData('item_loan_response.json')->item_loan[0]);
28
29
        $this->exists()->shouldBe(true);
30
    }
31
}
32

spec/Bibs/PortfoliosSpec.php 1 location

@@ 13-39 (lines=27) @@
10
use Scriptotek\Alma\Client as AlmaClient;
11
use spec\Scriptotek\Alma\SpecHelper;
12
13
class PortfoliosSpec extends ObjectBehavior
14
{
15
    public function let(AlmaClient $client, Bib $bib)
16
    {
17
        $bib->mms_id = 'abc';
18
        $this->beConstructedWith($client, $bib);
19
    }
20
21
    function it_is_initializable()
22
    {
23
        $this->shouldHaveType(Portfolios::class);
24
    }
25
26
    protected function expectRequest($client)
27
    {
28
        $client->getJSON('/bibs/abc/portfolios')
29
            ->shouldBeCalled()
30
            ->willReturn(SpecHelper::getDummyData('portfolios_response.json'));
31
    }
32
33
    public function it_is_countable(AlmaClient $client)
34
    {
35
        $this->expectRequest($client);
36
37
        $this->shouldHaveCount(1);
38
    }
39
}
40

spec/Bibs/RepresentationsSpec.php 1 location

@@ 12-38 (lines=27) @@
9
use Prophecy\Argument;
10
use spec\Scriptotek\Alma\SpecHelper;
11
12
class RepresentationsSpec extends ObjectBehavior
13
{
14
    public function let(AlmaClient $client, Bib $bib)
15
    {
16
        $bib->mms_id = 'abc';
17
        $this->beConstructedWith($client, $bib);
18
    }
19
20
    function it_is_initializable()
21
    {
22
        $this->shouldHaveType(Representations::class);
23
    }
24
25
    protected function expectRequest($client)
26
    {
27
        $client->getJSON('/bibs/abc/representations')
28
            ->shouldBeCalled()
29
            ->willReturn(SpecHelper::getDummyData('representations_response.json'));
30
    }
31
32
    public function it_is_countable(AlmaClient $client)
33
    {
34
        $this->expectRequest($client);
35
36
        $this->shouldHaveCount(2);
37
    }
38
}
39