mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Implemented hasClass
This commit is contained in:
parent
d00d70f440
commit
11d8ac9927
@ -36,4 +36,12 @@ trait ClassAttribut
|
||||
{
|
||||
return $this->class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasClass(): bool
|
||||
{
|
||||
return isset($this->class);
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,9 @@ interface ClassAttributInterface
|
||||
* @return string
|
||||
*/
|
||||
public function getClass(): string;
|
||||
|
||||
/**
|
||||
* @return bool True if class is defined
|
||||
*/
|
||||
public function hasClass(): bool;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ class ClassAttributTest extends TestCase
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->assertFalse($this->classAttribut->hasClass());
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->classAttribut->getClass();
|
||||
}
|
||||
@ -32,6 +33,7 @@ class ClassAttributTest extends TestCase
|
||||
{
|
||||
$class = AbstractSource::class;
|
||||
$this->assertNull($this->classAttribut->setClass($class));
|
||||
$this->assertTrue($this->classAttribut->hasClass());
|
||||
$this->assertEquals($class, $this->classAttribut->getClass());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user