mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Implemented ClassAttribut
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\ClassAttributInterface;
|
||||
use App\Attribut\ClassAttribut;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class ClassAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ClassAttributInterface
|
||||
*/
|
||||
protected $classAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->classAttribut = new class() implements ClassAttributInterface {
|
||||
use ClassAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->classAttribut->getClass();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$class = AbstractSource::class;
|
||||
$this->assertNull($this->classAttribut->setClass($class));
|
||||
$this->assertEquals($class, $this->classAttribut->getClass());
|
||||
}
|
||||
|
||||
public function testException(): void
|
||||
{
|
||||
$class = 'NOTEXISTINGCLASS';
|
||||
$this->expectException(NotFoundHttpException::class);
|
||||
$this->classAttribut->setClass($class);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user