mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Implemented slug for sources
This commit is contained in:
38
application/tests/Unit/Entity/Attribut/SlugAttributTest.php
Normal file
38
application/tests/Unit/Entity/Attribut/SlugAttributTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Entity\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Attribut\SlugAttributInterface;
|
||||
use App\Entity\Attribut\SlugAttribut;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class SlugAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var SlugAttributInterface
|
||||
*/
|
||||
protected $slugAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->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());
|
||||
}
|
||||
}
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user