mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-03 18:58:01 +00:00 
			
		
		
		
	Added tests for has- functions
This commit is contained in:
		@@ -6,6 +6,9 @@ use PHPUnit\Framework\TestCase;
 | 
			
		||||
use App\Entity\Attribut\IdAttribut;
 | 
			
		||||
use App\Entity\Attribut\IdAttributInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
class IdAttributTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
@@ -22,6 +25,7 @@ class IdAttributTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testConstruct(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->assertFalse($this->id->hasId());
 | 
			
		||||
        $this->expectException(\TypeError::class);
 | 
			
		||||
        $this->id->getId();
 | 
			
		||||
    }
 | 
			
		||||
@@ -31,5 +35,8 @@ class IdAttributTest extends TestCase
 | 
			
		||||
        $id = 1234;
 | 
			
		||||
        $this->assertNull($this->id->setId($id));
 | 
			
		||||
        $this->assertEquals($id, $this->id->getId());
 | 
			
		||||
        $this->assertTrue($this->id->hasId());
 | 
			
		||||
        $this->assertNull($this->id->setId(0));
 | 
			
		||||
        $this->assertTrue($this->id->hasId());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,7 @@ class SlugAttributTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testConstructor(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->assertFalse($this->slugAttribut->hasSlug());
 | 
			
		||||
        $this->expectException(\TypeError::class);
 | 
			
		||||
        $this->slugAttribut->getSlug();
 | 
			
		||||
    }
 | 
			
		||||
@@ -33,6 +34,9 @@ class SlugAttributTest extends TestCase
 | 
			
		||||
    {
 | 
			
		||||
        $slug = 'goodslug';
 | 
			
		||||
        $this->assertNull($this->slugAttribut->setSlug($slug));
 | 
			
		||||
        $this->assertTrue($this->slugAttribut->hasSlug());
 | 
			
		||||
        $this->assertEquals($slug, $this->slugAttribut->getSlug());
 | 
			
		||||
        $this->assertNull($this->slugAttribut->setSlug(''));
 | 
			
		||||
        $this->assertTrue($this->slugAttribut->hasSlug());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user