2019-01-06 14:38:28 +01:00
|
|
|
<?php
|
|
|
|
|
2019-05-30 16:43:40 +02:00
|
|
|
namespace tests\Unit\Domain\Path;
|
2019-01-06 14:38:28 +01:00
|
|
|
|
2019-05-30 16:43:40 +02:00
|
|
|
use Infinito\Domain\Path\NamespacePathMap;
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\Domain\Path\NamespacePathMapInterface;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-01-06 14:38:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class NamespacePathMapTest extends TestCase
|
|
|
|
{
|
|
|
|
const NAMESPACE = 'ABC\\DEF\GHD';
|
|
|
|
|
|
|
|
const PATH = 'abc/def/ghd';
|
|
|
|
|
|
|
|
const FOLDERS = [
|
|
|
|
'ABC',
|
|
|
|
'DEF',
|
|
|
|
'GHD',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var NamespacePathMapInterface
|
|
|
|
*/
|
|
|
|
private $namespacePathMap;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->namespacePathMap = new NamespacePathMap();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function validateArray(): void
|
|
|
|
{
|
|
|
|
$folders = $this->namespacePathMap->getFolders();
|
|
|
|
foreach (self::FOLDERS as $key => $folder) {
|
|
|
|
$this->assertEquals(strtolower($folder), $folders[$key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function validateGet(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals(strtolower(self::NAMESPACE), $this->namespacePathMap->getNamespace());
|
|
|
|
$this->assertEquals(self::PATH, $this->namespacePathMap->getPath());
|
|
|
|
$this->validateArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSetNamespace(): void
|
|
|
|
{
|
|
|
|
$this->namespacePathMap->setNamespace(self::NAMESPACE);
|
|
|
|
$this->validateGet();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSetPath(): void
|
|
|
|
{
|
|
|
|
$this->namespacePathMap->setPath(self::PATH);
|
|
|
|
$this->validateGet();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSetFolders(): void
|
|
|
|
{
|
|
|
|
$this->namespacePathMap->setFolders(self::FOLDERS);
|
|
|
|
$this->validateGet();
|
|
|
|
}
|
|
|
|
}
|