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

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

spec/Bibs/RepresentationsSpec.php 1 location

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