getId()); self::assertSame('PHP', $taxon->getName()); self::assertSame('php', $taxon->getSlug()); } public function testFromArrayHydratesTaxon(): void { $taxon = Taxon::fromArray([ 'id' => '6', 'name' => 'Tests', 'slug' => 'tests', ]); self::assertSame(6, $taxon->getId()); self::assertSame('Tests', $taxon->getName()); self::assertSame('tests', $taxon->getSlug()); } public function testValidationRejectsEmptyName(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Le nom du terme ne peut pas être vide'); new Taxon(1, '', 'slug'); } public function testValidationRejectsTooLongName(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Le nom du terme ne peut pas dépasser 100 caractères'); new Taxon(1, str_repeat('a', 101), 'slug'); } }