shlink/module/Common/test/Paginator/PaginableRepositoryAdapterTest.php

42 lines
1.1 KiB
PHP
Raw Normal View History

2016-07-30 18:45:48 +03:00
<?php
2017-10-12 11:13:20 +03:00
declare(strict_types=1);
2016-07-30 18:45:48 +03:00
namespace ShlinkioTest\Shlink\Common\Paginator;
2017-03-24 22:34:18 +03:00
use PHPUnit\Framework\TestCase;
2016-07-30 18:45:48 +03:00
use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
use Shlinkio\Shlink\Common\Repository\PaginableRepositoryInterface;
class PaginableRepositoryAdapterTest extends TestCase
{
/** @var PaginableRepositoryAdapter */
2016-07-30 18:45:48 +03:00
protected $adapter;
/** @var ObjectProphecy */
2016-07-30 18:45:48 +03:00
protected $repo;
public function setUp()
{
$this->repo = $this->prophesize(PaginableRepositoryInterface::class);
$this->adapter = new PaginableRepositoryAdapter($this->repo->reveal(), 'search', ['foo', 'bar'], 'order');
2016-07-30 18:45:48 +03:00
}
/**
* @test
*/
public function getItemsFallbacksToFindList()
{
2018-11-11 15:18:21 +03:00
$this->repo->findList(10, 5, 'search', ['foo', 'bar'], 'order')->shouldBeCalledOnce();
2016-07-30 18:45:48 +03:00
$this->adapter->getItems(5, 10);
}
/**
* @test
*/
public function countFallbacksToCountList()
{
2018-11-11 15:18:21 +03:00
$this->repo->countList('search', ['foo', 'bar'])->shouldBeCalledOnce();
2016-07-30 18:45:48 +03:00
$this->adapter->count();
}
}