Passed
Pull Request — master (#456)
by Alejandro
06:37 queued 01:57
created

ShortUrlRepositoryAdapterTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace ShlinkioTest\Shlink\Core\Paginator\Adapter;
5
6
use PHPUnit\Framework\TestCase;
7
use Prophecy\Prophecy\ObjectProphecy;
8
use Shlinkio\Shlink\Core\Paginator\Adapter\ShortUrlRepositoryAdapter;
9
use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface;
10
11
class ShortUrlRepositoryAdapterTest extends TestCase
12
{
13
    /** @var ShortUrlRepositoryAdapter */
14
    private $adapter;
15
    /** @var ObjectProphecy */
16
    private $repo;
17
18
    public function setUp(): void
19
    {
20
        $this->repo = $this->prophesize(ShortUrlRepositoryInterface::class);
21
        $this->adapter = new ShortUrlRepositoryAdapter($this->repo->reveal(), 'search', ['foo', 'bar'], 'order');
22
    }
23
24
    /** @test */
25
    public function getItemsFallbacksToFindList(): void
26
    {
27
        $this->repo->findList(10, 5, 'search', ['foo', 'bar'], 'order')->shouldBeCalledOnce();
28
        $this->adapter->getItems(5, 10);
29
    }
30
31
    /** @test */
32
    public function countFallbacksToCountList(): void
33
    {
34
        $this->repo->countList('search', ['foo', 'bar'])->shouldBeCalledOnce();
35
        $this->adapter->count();
36
    }
37
}
38