diff --git a/application/src/Entity/Attribut/SlugAttribut.php b/application/src/Entity/Attribut/SlugAttribut.php new file mode 100644 index 0000000..c38d198 --- /dev/null +++ b/application/src/Entity/Attribut/SlugAttribut.php @@ -0,0 +1,21 @@ +slug = $slug; + } + + public function getSlug(): string + { + return $this->slug; + } +} diff --git a/application/src/Entity/Attribut/SlugAttributInterface.php b/application/src/Entity/Attribut/SlugAttributInterface.php new file mode 100644 index 0000000..d106d87 --- /dev/null +++ b/application/src/Entity/Attribut/SlugAttributInterface.php @@ -0,0 +1,10 @@ +slugAttribut = new class() implements SlugAttributInterface { + use SlugAttribut; + }; + } + + public function testConstructor(): void + { + $this->expectException(\TypeError::class); + $this->slugAttribut->getSlug(); + } + + public function testAccessors(): void + { + $slug = 'goodslug'; + $this->assertNull($this->slugAttribut->setSlug($slug)); + $this->assertEquals($slug, $this->slugAttribut->getSlug()); + } +} diff --git a/application/tests/Unit/Entity/Source/AbstractSourceTest.php b/application/tests/Unit/Entity/Source/AbstractSourceTest.php index 24d2299..26dada2 100644 --- a/application/tests/Unit/Entity/Source/AbstractSourceTest.php +++ b/application/tests/Unit/Entity/Source/AbstractSourceTest.php @@ -33,4 +33,10 @@ class AbstractSourceTest extends TestCase $this->assertInstanceOf(Collection::class, $this->source->getMemberships()); $this->assertInstanceOf(LawInterface::class, $this->source->getLaw()); } + + public function testSlugInit(): void + { + $this->expectException(\TypeError::class); + $this->source->getSlug(); + } }