Skip to content

Commit

Permalink
Merge pull request #619 from tienvx/fix-missing-expression-on-import
Browse files Browse the repository at this point in the history
Fix missing expression on import
  • Loading branch information
tienvx committed Apr 29, 2022
2 parents d514d50 + 91e1b37 commit e37d5e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Factory/Model/Revision/TransitionFactory.php
Expand Up @@ -12,6 +12,7 @@ public static function createFromArray(array $data): TransitionInterface
$transition = new Transition();
$transition->setLabel($data['label'] ?? '');
$transition->setGuard($data['guard'] ?? null);
$transition->setExpression($data['expression'] ?? null);
$transition->setCommands(
array_map([CommandFactory::class, 'createFromArray'], ($data['commands'] ?? []))
);
Expand Down
2 changes: 2 additions & 0 deletions tests/Factory/Model/Revision/TransitionFactoryTest.php
Expand Up @@ -20,6 +20,7 @@ protected function setUp(): void
$this->data = [
'label' => 'Transition 1',
'guard' => 'count > 1',
'expression' => '{count: count + 1}',
'fromPlaces' => [1, 2],
'toPlaces' => [2, 3],
'commands' => [],
Expand All @@ -31,6 +32,7 @@ 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());
Expand Down

0 comments on commit e37d5e6

Please sign in to comment.