Completed
Push — master ( 08bd4f...c70077 )
by Alejandro
24s queued 10s
created

PaginableRepositoryAdapterTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getItemsFallbacksToFindList() 0 4 1
A setUp() 0 4 1
A countFallbacksToCountList() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace ShlinkioTest\Shlink\Common\Paginator\Adapter;
5
6
use PHPUnit\Framework\TestCase;
7
use Prophecy\Prophecy\ObjectProphecy;
8
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
9
use Shlinkio\Shlink\Common\Repository\PaginableRepositoryInterface;
10
11
class PaginableRepositoryAdapterTest extends TestCase
12
{
13
    /** @var PaginableRepositoryAdapter */
14
    private $adapter;
15
    /** @var ObjectProphecy */
16
    private $repo;
17
18
    public function setUp(): void
19
    {
20
        $this->repo = $this->prophesize(PaginableRepositoryInterface::class);
21
        $this->adapter = new PaginableRepositoryAdapter($this->repo->reveal(), 'search', ['foo', 'bar'], 'order');
22
    }
23
24
    /** @test */
25
    public function getItemsFallbacksToFindList()
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()
33
    {
34
        $this->repo->countList('search', ['foo', 'bar'])->shouldBeCalledOnce();
35
        $this->adapter->count();
36
    }
37
}
38