diff --git a/application/symfony/src/Attribut/ClassAttribut.php b/application/symfony/src/Attribut/ClassAttribut.php new file mode 100644 index 0000000..c33b9a4 --- /dev/null +++ b/application/symfony/src/Attribut/ClassAttribut.php @@ -0,0 +1,39 @@ +class = $class; + + return; + } + throw new NotFoundHttpException('Class '.$class.' couldn\'t be found!'); + } + + /** + * @return string + */ + public function getClass(): string + { + return $this->class; + } +} diff --git a/application/symfony/src/Attribut/ClassAttributInterface.php b/application/symfony/src/Attribut/ClassAttributInterface.php new file mode 100644 index 0000000..51d7082 --- /dev/null +++ b/application/symfony/src/Attribut/ClassAttributInterface.php @@ -0,0 +1,19 @@ +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); + } +}