mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Renamed domain RequestManagement to Request
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace tests\Unit\Domain\Request\Action;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Infinito\Domain\Request\Right\RequestedRightInterface;
|
||||
use Infinito\Domain\Request\Action\RequestedActionInterface;
|
||||
use Infinito\Domain\Request\Right\RequestedRight;
|
||||
use Infinito\Domain\Request\Action\RequestedAction;
|
||||
use Infinito\DBAL\Types\ActionType;
|
||||
use Infinito\Repository\Source\SourceRepositoryInterface;
|
||||
use Infinito\DBAL\Types\Meta\Right\LayerType;
|
||||
use Infinito\Domain\UserManagement\UserSourceDirector;
|
||||
use Infinito\Domain\Request\User\RequestedUser;
|
||||
use Infinito\Entity\Source\Complex\UserSourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class RequestedActionTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var RequestedRightInterface
|
||||
*/
|
||||
private $requestedRight;
|
||||
|
||||
/**
|
||||
* @var RequestedActionInterface
|
||||
*/
|
||||
private $action;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \PHPUnit\Framework\TestCase::setUp()
|
||||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
$userSource = $this->createMock(UserSourceInterface::class);
|
||||
$sourceRepository = $this->createMock(SourceRepositoryInterface::class);
|
||||
$sourceRepository->method('findOneBySlug')->willReturn($userSource);
|
||||
$user = null;
|
||||
$userSourceDirector = new UserSourceDirector($sourceRepository, $user);
|
||||
$requestedRight = new RequestedRight();
|
||||
$this->requestedRight = new RequestedUser($userSourceDirector, $requestedRight);
|
||||
$this->action = new RequestedAction($this->requestedRight);
|
||||
}
|
||||
|
||||
public function testList(): void
|
||||
{
|
||||
$list = ActionType::EXECUTE;
|
||||
$this->action->setActionType($list);
|
||||
$this->assertEquals($list, $this->action->getActionType());
|
||||
$this->assertEquals(ActionType::EXECUTE, $this->requestedRight->getActionType());
|
||||
}
|
||||
|
||||
public function testCrud(): void
|
||||
{
|
||||
foreach (ActionType::getValues() as $crud) {
|
||||
$userSource = $this->createMock(UserSourceInterface::class);
|
||||
$sourceRepository = $this->createMock(SourceRepositoryInterface::class);
|
||||
$sourceRepository->method('findOneBySlug')->willReturn($userSource);
|
||||
$user = null;
|
||||
$userSourceDirector = new UserSourceDirector($sourceRepository, $user);
|
||||
$requestedRight = new RequestedRight();
|
||||
$this->requestedRight = new RequestedUser($userSourceDirector, $requestedRight);
|
||||
$this->action = new RequestedAction($this->requestedRight);
|
||||
$this->action->setActionType($crud);
|
||||
$this->assertEquals($crud, $this->action->getActionType());
|
||||
$this->assertEquals($crud, $this->requestedRight->getActionType());
|
||||
}
|
||||
}
|
||||
|
||||
public function testLayer(): void
|
||||
{
|
||||
foreach (LayerType::getValues() as $LayerType) {
|
||||
$this->action->setLayer($LayerType);
|
||||
$this->assertEquals($LayerType, $this->action->getLayer());
|
||||
$this->assertEquals($LayerType, $this->requestedRight->getLayer());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user