infinito/application/symfony/tests/Unit/Domain/Action/ActionFactoryServiceTest.php

39 lines
1.6 KiB
PHP
Raw Normal View History

2019-01-27 15:28:25 +01:00
<?php
namespace tests\Unit\Domain\Action;
2019-01-27 15:28:25 +01:00
use PHPUnit\Framework\TestCase;
use Infinito\Domain\Action\ActionFactoryService;
use Infinito\Domain\Action\ActionDependenciesDAOServiceInterface;
use Infinito\Domain\Action\ActionInterface;
use Infinito\Domain\Request\Action\RequestedAction;
use Infinito\Domain\Request\Right\RequestedRight;
use Infinito\Domain\Layer\LayerActionMap;
use Infinito\Domain\Request\User\RequestedUser;
use Infinito\Domain\UserManagement\UserSourceDirectorInterface;
2019-01-27 15:28:25 +01:00
/**
* @author kevinfrantz
*/
class ActionFactoryServiceTest extends TestCase
{
public function testCreate(): void
{
foreach (LayerActionMap::LAYER_ACTION_MAP as $layer => $actions) {
foreach ($actions as $action) {
2019-02-26 20:06:07 +01:00
$requestedRight = new RequestedRight();
$userSourceDirector = $this->createMock(UserSourceDirectorInterface::class);
$requestedUser = new RequestedUser($userSourceDirector, $requestedRight);
$requestedAction = new RequestedAction($requestedUser);
$actionService = $this->createMock(ActionDependenciesDAOServiceInterface::class);
2019-02-26 20:06:07 +01:00
$actionService->method('getRequestedAction')->willReturn($requestedAction);
$actionFactoryService = new ActionFactoryService($actionService);
$requestedAction->setLayer($layer);
$requestedAction->setActionType($action);
$result = $actionFactoryService->create();
$this->assertInstanceOf(ActionInterface::class, $result);
2019-01-27 15:28:25 +01:00
}
}
}
}