From 3b25fb27fef199b421f83f4a5e8a8b173e9468c4 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 23 Oct 2022 20:28:45 +0200 Subject: [PATCH] Migrated TagsPaginatorAdapterTest to use PHPUnit mocks --- .../Adapter/TagsPaginatorAdapterTest.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/module/Core/test/Tag/Paginator/Adapter/TagsPaginatorAdapterTest.php b/module/Core/test/Tag/Paginator/Adapter/TagsPaginatorAdapterTest.php index ccad1ec1..bce7d9cc 100644 --- a/module/Core/test/Tag/Paginator/Adapter/TagsPaginatorAdapterTest.php +++ b/module/Core/test/Tag/Paginator/Adapter/TagsPaginatorAdapterTest.php @@ -4,34 +4,27 @@ declare(strict_types=1); namespace ShlinkioTest\Shlink\Core\Tag\Paginator\Adapter; +use PHPUnit\Framework\MockObject\MockObject; 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\Paginator\Adapter\TagsPaginatorAdapter; use Shlinkio\Shlink\Core\Tag\Repository\TagRepositoryInterface; class TagsPaginatorAdapterTest extends TestCase { - use ProphecyTrait; - private TagsPaginatorAdapter $adapter; - private ObjectProphecy $repo; + private MockObject $repo; protected function setUp(): void { - $this->repo = $this->prophesize(TagRepositoryInterface::class); - $this->adapter = new TagsPaginatorAdapter($this->repo->reveal(), TagsParams::fromRawData([]), null); + $this->repo = $this->createMock(TagRepositoryInterface::class); + $this->adapter = new TagsPaginatorAdapter($this->repo, TagsParams::fromRawData([]), null); } /** @test */ public function getSliceDelegatesToRepository(): void { - $match = $this->repo->match(Argument::cetera())->willReturn([]); - + $this->repo->expects($this->once())->method('match')->willReturn([]); $this->adapter->getSlice(1, 1); - - $match->shouldHaveBeenCalledOnce(); } }