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