diff --git a/module/Core/test/Tag/Paginator/Adapter/TagsInfoPaginatorAdapterTest.php b/module/Core/test/Tag/Paginator/Adapter/TagsInfoPaginatorAdapterTest.php new file mode 100644 index 00000000..2fc354ba --- /dev/null +++ b/module/Core/test/Tag/Paginator/Adapter/TagsInfoPaginatorAdapterTest.php @@ -0,0 +1,48 @@ +repo = $this->prophesize(TagRepositoryInterface::class); + $this->adapter = new TagsInfoPaginatorAdapter($this->repo->reveal(), TagsParams::fromRawData([]), null); + } + + /** @test */ + public function getSliceIsDelegatedToRepository(): void + { + $findTags = $this->repo->findTagsWithInfo(Argument::cetera())->willReturn([]); + + $this->adapter->getSlice(1, 1); + + $findTags->shouldHaveBeenCalledOnce(); + } + + /** @test */ + public function getNbResultsIsDelegatedToRepository(): void + { + $match = $this->repo->matchSingleScalarResult(Argument::cetera())->willReturn(3); + + $result = $this->adapter->getNbResults(); + + self::assertEquals(3, $result); + $match->shouldHaveBeenCalledOnce(); + } +} diff --git a/module/Core/test/Tag/Paginator/Adapter/TagsPaginatorAdapterTest.php b/module/Core/test/Tag/Paginator/Adapter/TagsPaginatorAdapterTest.php new file mode 100644 index 00000000..4cbfd703 --- /dev/null +++ b/module/Core/test/Tag/Paginator/Adapter/TagsPaginatorAdapterTest.php @@ -0,0 +1,37 @@ +repo = $this->prophesize(TagRepositoryInterface::class); + $this->adapter = new TagsPaginatorAdapter($this->repo->reveal(), TagsParams::fromRawData([]), null); + } + + /** @test */ + public function getSliceDelegatesToRepository(): void + { + $match = $this->repo->match(Argument::cetera())->willReturn([]); + + $this->adapter->getSlice(1, 1); + + $match->shouldHaveBeenCalledOnce(); + } +} diff --git a/module/Core/test/Service/Tag/TagServiceTest.php b/module/Core/test/Tag/TagServiceTest.php similarity index 99% rename from module/Core/test/Service/Tag/TagServiceTest.php rename to module/Core/test/Tag/TagServiceTest.php index 40d50b36..75b02163 100644 --- a/module/Core/test/Service/Tag/TagServiceTest.php +++ b/module/Core/test/Tag/TagServiceTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ShlinkioTest\Shlink\Core\Service\Tag; +namespace ShlinkioTest\Shlink\Core\Tag; use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase;