Implemented LayerRepositoryFactoryAttribut

This commit is contained in:
Kevin Frantz 2019-01-27 11:53:29 +01:00
parent 49cba2866a
commit f7242f725e
3 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<?php
namespace App\Attribut;
use App\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
/**
* @author kevinfrantz
*
* @see LayerRepositoryFactoryServiceAttributInterface
*/
trait LayerRepositoryFactoryServiceAttribut
{
/**
* @var LayerRepositoryFactoryServiceInterface
*/
protected $layerRepositoryFactoryService;
/**
* @param LayerRepositoryFactoryServiceInterface $layerRepositoryFactoryService
*/
public function setLayerRepositoryFactoryService(LayerRepositoryFactoryServiceInterface $layerRepositoryFactoryService): void
{
$this->layerRepositoryFactoryService = $layerRepositoryFactoryService;
}
/**
* @return LayerRepositoryFactoryServiceInterface
*/
public function getLayerRepositoryFactoryService(): LayerRepositoryFactoryServiceInterface
{
return $this->layerRepositoryFactoryService;
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Attribut;
use App\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
/**
* @author kevinfrantz
*/
interface LayerRepositoryFactoryServiceAttributInterface
{
/**
* @param LayerRepositoryFactoryServiceInterface $layerRepositoryFactoryService
*/
public function setLayerRepositoryFactoryService(LayerRepositoryFactoryServiceInterface $layerRepositoryFactoryService): void;
/**
* @return LayerRepositoryFactoryServiceInterface
*/
public function getLayerRepositoryFactoryService(): LayerRepositoryFactoryServiceInterface;
}

View File

@ -0,0 +1,39 @@
<?php
namespace Tests\Unit\Attribut;
use PHPUnit\Framework\TestCase;
use App\Attribut\LayerRepositoryFactoryServiceAttributInterface;
use App\Attribut\LayerRepositoryFactoryServiceAttribut;
use App\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
/**
* @author kevinfrantz
*/
class RequestAttributTest extends TestCase
{
/**
* @var LayerRepositoryFactoryServiceAttributInterface
*/
protected $layerRepositoryFactoryServiceAttribut;
public function setUp(): void
{
$this->layerRepositoryFactoryServiceAttribut = new class() implements LayerRepositoryFactoryServiceAttributInterface {
use LayerRepositoryFactoryServiceAttribut;
};
}
public function testConstruct(): void
{
$this->expectException(\TypeError::class);
$this->layerRepositoryFactoryServiceAttribut->getLayerRepositoryFactoryService();
}
public function testAccessors(): void
{
$layerRepositoryFactoryService = $this->createMock(LayerRepositoryFactoryServiceInterface::class);
$this->assertNull($this->layerRepositoryFactoryServiceAttribut->setLayerRepositoryFactoryService($layerRepositoryFactoryService));
$this->assertEquals($layerRepositoryFactoryService, $this->layerRepositoryFactoryServiceAttribut->getLayerRepositoryFactoryService());
}
}