infinito/application/symfony/tests/Unit/Attribut/ConditionAttributTest.php

39 lines
1.0 KiB
PHP
Raw Normal View History

2018-11-06 20:56:54 +01:00
<?php
2019-01-20 10:41:58 +01:00
namespace Attribut;
2018-11-06 20:56:54 +01:00
use PHPUnit\Framework\TestCase;
use Infinito\Attribut\ConditionAttributInterface;
use Infinito\Attribut\ConditionAttribut;
use Infinito\Logic\Operation\OperationInterface;
2018-11-06 20:56:54 +01:00
class ConditionAttributTest extends TestCase
{
/**
* @var ConditionAttributInterface
*/
protected $condition;
public function setUp(): void
{
$this->condition = new class() implements ConditionAttributInterface {
use ConditionAttribut;
};
}
public function testConstructor(): void
{
$this->expectException(\TypeError::class);
$this->condition->getCondition();
}
public function testAccessors(): void
{
$this->assertEquals(false, $this->condition->hasCondition());
$condition = $this->createMock(OperationInterface::class);
$this->assertNull($this->condition->setCondition($condition));
$this->assertEquals(true, $this->condition->hasCondition());
$this->assertEquals($condition, $this->condition->getCondition());
}
}