Transformed RequestedActionFormBuilderServiceIntegrationTest to injection testing via kernel

This commit is contained in:
Kevin Frantz 2019-02-16 08:50:46 +01:00
parent d1ff628087
commit 8f0b806719
2 changed files with 7 additions and 20 deletions

View File

@ -54,4 +54,6 @@ services:
App\Domain\RequestManagement\User\RequestedUserService:
public: true
App\Domain\RequestManagement\Action\RequestedActionService:
public: true
App\Domain\FormManagement\RequestedActionFormBuilderService:
public: true

View File

@ -8,16 +8,10 @@ use App\Entity\Source\PureSource;
use App\Domain\FormManagement\RequestedActionFormBuilderService;
use App\Domain\RequestManagement\Action\RequestedActionServiceInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use App\Domain\FormManagement\FormClassNameService;
use App\Domain\RequestManagement\Action\RequestedActionService;
use App\Domain\RequestManagement\User\RequestedUserService;
use App\Domain\RequestManagement\Right\RequestedRightService;
use App\Domain\UserManagement\UserSourceDirectorServiceInterface;
use App\DBAL\Types\ActionType;
use App\Domain\RequestManagement\Entity\RequestedEntityService;
use App\Domain\RepositoryManagement\LayerRepositoryFactoryService;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\Form;
use App\Domain\FormManagement\RequestedActionFormBuilderServiceInterface;
use App\Domain\RequestManagement\Entity\RequestedEntityServiceInterface;
/**
* @author kevinfrantz
@ -47,19 +41,10 @@ class RequestedActionFormBuilderServiceIntegrationTest extends KernelTestCase
public function setUp(): void
{
self::bootKernel();
$formFactory = self::$container->get('form.factory');
//$entityManager = self::$container->get('doctrine.orm.default_entity_manager');
$entityManager = $this->createMock(EntityManagerInterface::class);
$userSourceDirectorService = $this->createMock(UserSourceDirectorServiceInterface::class);
$formClassNameService = new FormClassNameService();
$layerRepositoryFactoryService = new LayerRepositoryFactoryService($entityManager);
$this->requestedEntity = new RequestedEntityService($layerRepositoryFactoryService);
$requestedRightService = new RequestedRightService($this->requestedEntity);
$requestedRightService->setRequestedEntity($this->requestedEntity);
$requestedUserService = new RequestedUserService($userSourceDirectorService, $requestedRightService);
$this->requestedActionService = new RequestedActionService($requestedUserService);
$this->requestedActionFormBuilderService = self::$container->get(RequestedActionFormBuilderServiceInterface::class);
$this->requestedEntity = self::$container->get(RequestedEntityServiceInterface::class);
$this->requestedActionService = self::$container->get(RequestedActionServiceInterface::class);
$this->requestedActionService->setActionType(ActionType::CREATE);
$this->requestedActionFormBuilderService = new RequestedActionFormBuilderService($formFactory, $formClassNameService, $this->requestedActionService);
}
public function testCreate(): void