mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 08:56:42 -06:00
Migrated TagsPaginatorAdapterTest to use PHPUnit mocks
This commit is contained in:
parent
3b20f955ff
commit
3b25fb27fe
@ -4,34 +4,27 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace ShlinkioTest\Shlink\Core\Tag\Paginator\Adapter;
|
namespace ShlinkioTest\Shlink\Core\Tag\Paginator\Adapter;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
|
||||||
use Shlinkio\Shlink\Core\Tag\Model\TagsParams;
|
use Shlinkio\Shlink\Core\Tag\Model\TagsParams;
|
||||||
use Shlinkio\Shlink\Core\Tag\Paginator\Adapter\TagsPaginatorAdapter;
|
use Shlinkio\Shlink\Core\Tag\Paginator\Adapter\TagsPaginatorAdapter;
|
||||||
use Shlinkio\Shlink\Core\Tag\Repository\TagRepositoryInterface;
|
use Shlinkio\Shlink\Core\Tag\Repository\TagRepositoryInterface;
|
||||||
|
|
||||||
class TagsPaginatorAdapterTest extends TestCase
|
class TagsPaginatorAdapterTest extends TestCase
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
|
||||||
|
|
||||||
private TagsPaginatorAdapter $adapter;
|
private TagsPaginatorAdapter $adapter;
|
||||||
private ObjectProphecy $repo;
|
private MockObject $repo;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->repo = $this->prophesize(TagRepositoryInterface::class);
|
$this->repo = $this->createMock(TagRepositoryInterface::class);
|
||||||
$this->adapter = new TagsPaginatorAdapter($this->repo->reveal(), TagsParams::fromRawData([]), null);
|
$this->adapter = new TagsPaginatorAdapter($this->repo, TagsParams::fromRawData([]), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function getSliceDelegatesToRepository(): void
|
public function getSliceDelegatesToRepository(): void
|
||||||
{
|
{
|
||||||
$match = $this->repo->match(Argument::cetera())->willReturn([]);
|
$this->repo->expects($this->once())->method('match')->willReturn([]);
|
||||||
|
|
||||||
$this->adapter->getSlice(1, 1);
|
$this->adapter->getSlice(1, 1);
|
||||||
|
|
||||||
$match->shouldHaveBeenCalledOnce();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user