infinito/application/symfony/tests/Unit/Domain/ActionManagement/ActionServiceTest.php

32 lines
1.2 KiB
PHP
Raw Normal View History

2019-01-27 09:35:43 +01:00
<?php
namespace tests\Unit\Domain\ActionManagement;
use PHPUnit\Framework\TestCase;
use App\Domain\ActionManagement\ActionService;
use App\Domain\RequestManagement\Action\RequestedActionInterface;
use App\Domain\SecureManagement\SecureRequestedRightCheckerInterface;
/**
* @author kevinfrantz
*/
class ActionServiceTest extends TestCase
{
public function testIsRequestedActionSecure()
{
$requestedAction = $this->createMock(RequestedActionInterface::class);
$secureRequestedRightChecker = $this->createMock(SecureRequestedRightCheckerInterface::class);
$secureRequestedRightChecker->method('check')->willReturn(true);
$actionService = new ActionService($requestedAction, $secureRequestedRightChecker);
$this->assertTrue($actionService->isRequestedActionSecure());
}
public function testRequestedActionGetter()
{
$requestedAction = $this->createMock(RequestedActionInterface::class);
$secureRequestedRightChecker = $this->createMock(SecureRequestedRightCheckerInterface::class);
$actionService = new ActionService($requestedAction, $secureRequestedRightChecker);
$this->assertInstanceOf(RequestedActionInterface::class, $actionService->getRequestedAction());
}
}