Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
'places' => Places::cases(),
'transitions' => [
'one' => [
'from' => Places::A->value,
'to' => Places::B->value,
'from' => Places::A,
'to' => Places::B,
],
'two' => [
'from' => Places::B->value,
'to' => Places::C->value,
'from' => Places::B,
'to' => Places::C,
],
],
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places;
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase;

$container->loadFromExtension('framework', [
'workflows' => [
'enum' => [
'supports' => [
FrameworkExtensionTestCase::class,
],
'places' => Places::class.'::*',
'transitions' => [
'one' => [
'from' => Places::A,
'to' => Places::B,
],
'two' => [
'from' => Places::B,
'to' => Places::C,
],
],
]
],
]);
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places;
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase;

$container->loadFromExtension('framework', [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
framework:
workflows:
enum:
supports:
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
places: 'Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::*'
transitions:
one:
from: !php/enum Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::A
to: !php/enum Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::B
two:
from: !php/enum Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::B
to: !php/enum Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::C
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,21 @@ public function testWorkflowMultipleTransitionsWithSameName()
], $container->getDefinition($transitions[4])->getArguments());
}

public function testWorkflowEnum()
public function testWorkflowEnumPlaces()
{
$container = $this->createContainerFromFile('workflow_enum');
$container = $this->createContainerFromFile('workflow_enum_places');

$workflowDefinition = $container->getDefinition('state_machine.enum.definition');
$this->assertSame(['a', 'b', 'c'], $workflowDefinition->getArgument(0));
$transitionOne = $container->getDefinition('.state_machine.enum.transition.0');
$this->assertSame(['one', 'a', 'b'], $transitionOne->getArguments());
$transitionTwo = $container->getDefinition('.state_machine.enum.transition.1');
$this->assertSame(['two', 'b', 'c'], $transitionTwo->getArguments());
}

public function testWorkflowGlobPlaces()
{
$container = $this->createContainerFromFile('workflow_glob_places');

$workflowDefinition = $container->getDefinition('state_machine.enum.definition');
$this->assertSame(['a', 'b', 'c'], $workflowDefinition->getArgument(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ public function testAssetMapper()
$definition = $container->getDefinition('asset_mapper.compiler.css_asset_url_compiler');
$this->assertSame('strict', $definition->getArgument(0));
}

public function testWorkflowEnumPlaces()
{
$this->markTestSkipped('XML configuration does not allow to reference enums.');
}
}
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/FrameworkBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"symfony/type-info": "^7.1.8|^8.0",
"symfony/validator": "^7.4|^8.0",
"symfony/workflow": "^7.3|^8.0",
"symfony/yaml": "^6.4|^7.0|^8.0",
"symfony/yaml": "^7.3|^8.0",
"symfony/property-info": "^6.4|^7.0|^8.0",
"symfony/json-streamer": "^7.3|^8.0",
"symfony/uid": "^6.4|^7.0|^8.0",
Expand Down
Loading