2019-01-27 16:24:57 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace tests\Unit\Domain\ActionManagement\Read;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Domain\ActionManagement\ActionInterface;
|
|
|
|
use Infinito\Domain\ActionManagement\AbstractAction;
|
|
|
|
use Infinito\Domain\ActionManagement\ActionServiceInterface;
|
2019-01-27 16:24:57 +01:00
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Exception\NotValidByFormException;
|
2019-01-27 16:24:57 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class AbstractActionTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var ActionInterface
|
|
|
|
*/
|
|
|
|
private $action;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var ActionServiceInterface|MockObject
|
|
|
|
*/
|
|
|
|
private $actionService;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->actionService = $this->createMock(ActionServiceInterface::class);
|
|
|
|
$this->action = new class($this->actionService) extends AbstractAction {
|
|
|
|
public $isSecure;
|
|
|
|
public $validByForm;
|
|
|
|
|
|
|
|
protected function isSecure(): bool
|
|
|
|
{
|
|
|
|
return $this->isSecure;
|
|
|
|
}
|
|
|
|
|
2019-02-12 16:47:37 +01:00
|
|
|
protected function isValid(): bool
|
2019-01-27 16:24:57 +01:00
|
|
|
{
|
|
|
|
return $this->validByForm;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function proccess()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testNotValidByFormException(): void
|
|
|
|
{
|
|
|
|
$this->action->isSecure = true;
|
|
|
|
$this->action->validByForm = false;
|
|
|
|
$this->expectException(NotValidByFormException::class);
|
|
|
|
$this->action->execute();
|
|
|
|
}
|
|
|
|
}
|