mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-03 18:58:01 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace Attribut;
 | 
						|
 | 
						|
use PHPUnit\Framework\TestCase;
 | 
						|
use Infinito\Attribut\ClassAttributInterface;
 | 
						|
use Infinito\Attribut\ClassAttribut;
 | 
						|
use Infinito\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->assertFalse($this->classAttribut->hasClass());
 | 
						|
        $this->expectException(\TypeError::class);
 | 
						|
        $this->classAttribut->getClass();
 | 
						|
    }
 | 
						|
 | 
						|
    public function testAccessors(): void
 | 
						|
    {
 | 
						|
        $class = AbstractSource::class;
 | 
						|
        $this->assertNull($this->classAttribut->setClass($class));
 | 
						|
        $this->assertTrue($this->classAttribut->hasClass());
 | 
						|
        $this->assertEquals($class, $this->classAttribut->getClass());
 | 
						|
    }
 | 
						|
 | 
						|
    public function testException(): void
 | 
						|
    {
 | 
						|
        $class = 'NOTEXISTINGCLASS';
 | 
						|
        $this->expectException(NotFoundHttpException::class);
 | 
						|
        $this->classAttribut->setClass($class);
 | 
						|
    }
 | 
						|
}
 |