first commit

This commit is contained in:
julien
2026-03-20 22:13:41 +01:00
commit 41f8b3afb4
323 changed files with 27222 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace Tests\Taxonomy;
use Netig\Netslim\Taxonomy\Application\TaxonomyServiceInterface;
use Netig\Netslim\Taxonomy\Domain\Entity\Taxon;
use Netig\Netslim\Taxonomy\Infrastructure\TaxonomyServiceReader;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
#[\PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations]
final class TaxonomyServiceReaderTest extends TestCase
{
/** @var TaxonomyServiceInterface&MockObject */
private TaxonomyServiceInterface $taxonomyService;
private TaxonomyServiceReader $reader;
protected function setUp(): void
{
$this->taxonomyService = $this->createMock(TaxonomyServiceInterface::class);
$this->reader = new TaxonomyServiceReader($this->taxonomyService);
}
public function testFindAllMapsCategoriesToTaxonViews(): void
{
$this->taxonomyService->expects($this->once())
->method('findAll')
->willReturn([
new Taxon(1, 'PHP', 'php'),
new Taxon(2, 'Slim', 'slim'),
]);
$taxons = $this->reader->findAll();
self::assertCount(2, $taxons);
self::assertSame('PHP', $taxons[0]->name);
self::assertSame('slim', $taxons[1]->slug);
}
public function testFindBySlugReturnsNullWhenMissing(): void
{
$this->taxonomyService->expects($this->once())
->method('findBySlug')
->with('missing')
->willReturn(null);
self::assertNull($this->reader->findBySlug('missing'));
}
}