mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 09:19:08 +00:00 
			
		
		
		
	Implemented hasClass
This commit is contained in:
		| @@ -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()); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user