mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-04-16 10:16:22 +02:00
Optimized LayerIconClassMap
This commit is contained in:
parent
b6819b6db0
commit
1aa669b270
@ -27,7 +27,7 @@ final class LayerIconClassMap implements LayerIconClassMapInterface
|
|||||||
*
|
*
|
||||||
* @see \Infinito\Domain\TwigManagement\LayerIconClassMapInterface::getIconClass()
|
* @see \Infinito\Domain\TwigManagement\LayerIconClassMapInterface::getIconClass()
|
||||||
*/
|
*/
|
||||||
public function getIconClass(string $layer): string
|
public static function getIconClass(string $layer): string
|
||||||
{
|
{
|
||||||
if (key_exists($layer, self::LAYER_ICON_CLASS_MAP)) {
|
if (key_exists($layer, self::LAYER_ICON_CLASS_MAP)) {
|
||||||
return self::LAYER_ICON_CLASS_MAP[$layer];
|
return self::LAYER_ICON_CLASS_MAP[$layer];
|
||||||
|
@ -14,5 +14,5 @@ interface LayerIconClassMapInterface
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIconClass(string $layer): string;
|
public static function getIconClass(string $layer): string;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace tests\Unit\Domain\TwigManagement;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Infinito\Exception\NotSetException;
|
||||||
|
use Infinito\Domain\TwigManagement\LayerIconClassMap;
|
||||||
|
use Infinito\DBAL\Types\Meta\Right\LayerType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
class LayerIconClassMapTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testException(): void
|
||||||
|
{
|
||||||
|
$this->expectException(NotSetException::class);
|
||||||
|
$this->assertIsString(LayerIconClassMap::getIconClass('123123V'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAllLayersSet(): void
|
||||||
|
{
|
||||||
|
foreach (LayerType::getValues() as $value) {
|
||||||
|
$this->assertIsString(LayerIconClassMap::getIconClass($value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user