/
TransitionFactoryTest.php
40 lines (35 loc) · 1.27 KB
/
TransitionFactoryTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Tienvx\Bundle\MbtBundle\Tests\Factory\Model\Revision;
use PHPUnit\Framework\TestCase;
use Tienvx\Bundle\MbtBundle\Factory\Model\Revision\TransitionFactory;
/**
* @covers \Tienvx\Bundle\MbtBundle\Factory\Model\Revision\TransitionFactory
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\HasCommands
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Transition
*/
class TransitionFactoryTest extends TestCase
{
protected array $data;
protected function setUp(): void
{
$this->data = [
'label' => 'Transition 1',
'guard' => 'count > 1',
'expression' => '{count: count + 1}',
'fromPlaces' => [1, 2],
'toPlaces' => [2, 3],
'commands' => [],
];
}
public function testCreateFromArray(): void
{
$transition = TransitionFactory::createFromArray($this->data);
$this->assertSame('Transition 1', $transition->getLabel());
$this->assertSame('count > 1', $transition->getGuard());
$this->assertSame('{count: count + 1}', $transition->getExpression());
$this->assertSame([1, 2], $transition->getFromPlaces());
$this->assertSame([2, 3], $transition->getToPlaces());
$this->assertIsArray($transition->getCommands());
}
}