Skip to content

Commit 69993f9

Browse files
committed
fix tests
1 parent 4d58fa7 commit 69993f9

File tree

9 files changed

+62
-8
lines changed

9 files changed

+62
-8
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_enum.php renamed to src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_enum_places.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
'places' => Places::cases(),
1313
'transitions' => [
1414
'one' => [
15-
'from' => Places::A->value,
16-
'to' => Places::B->value,
15+
'from' => Places::A,
16+
'to' => Places::B,
1717
],
1818
'two' => [
19-
'from' => Places::B->value,
20-
'to' => Places::C->value,
19+
'from' => Places::B,
20+
'to' => Places::C,
2121
],
2222
],
2323
]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places;
4+
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase;
5+
6+
$container->loadFromExtension('framework', [
7+
'workflows' => [
8+
'enum' => [
9+
'supports' => [
10+
FrameworkExtensionTestCase::class,
11+
],
12+
'places' => Places::class.'::*',
13+
'transitions' => [
14+
'one' => [
15+
'from' => Places::A,
16+
'to' => Places::B,
17+
],
18+
'two' => [
19+
'from' => Places::B,
20+
'to' => Places::C,
21+
],
22+
],
23+
]
24+
],
25+
]);

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places;
43
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase;
54

65
$container->loadFromExtension('framework', [
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
framework:
2+
workflows:
3+
enum:
4+
supports:
5+
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
6+
places: 'Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::*'
7+
transitions:
8+
one:
9+
from: !php/enum Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::A
10+
to: !php/enum Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::B
11+
two:
12+
from: !php/enum Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::B
13+
to: !php/enum Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Places::C

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,21 @@ public function testWorkflowMultipleTransitionsWithSameName()
519519
], $container->getDefinition($transitions[4])->getArguments());
520520
}
521521

522-
public function testWorkflowEnum()
522+
public function testWorkflowEnumPlaces()
523523
{
524-
$container = $this->createContainerFromFile('workflow_enum');
524+
$container = $this->createContainerFromFile('workflow_enum_places');
525+
526+
$workflowDefinition = $container->getDefinition('state_machine.enum.definition');
527+
$this->assertSame(['a', 'b', 'c'], $workflowDefinition->getArgument(0));
528+
$transitionOne = $container->getDefinition('.state_machine.enum.transition.0');
529+
$this->assertSame(['one', 'a', 'b'], $transitionOne->getArguments());
530+
$transitionTwo = $container->getDefinition('.state_machine.enum.transition.1');
531+
$this->assertSame(['two', 'b', 'c'], $transitionTwo->getArguments());
532+
}
533+
534+
public function testWorkflowGlobPlaces()
535+
{
536+
$container = $this->createContainerFromFile('workflow_glob_places');
525537

526538
$workflowDefinition = $container->getDefinition('state_machine.enum.definition');
527539
$this->assertSame(['a', 'b', 'c'], $workflowDefinition->getArgument(0));

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/XmlFrameworkExtensionTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,9 @@ public function testAssetMapper()
5959
$definition = $container->getDefinition('asset_mapper.compiler.css_asset_url_compiler');
6060
$this->assertSame('strict', $definition->getArgument(0));
6161
}
62+
63+
public function testWorkflowEnumPlaces()
64+
{
65+
$this->markTestSkipped('XML configuration does not allow to reference enums.');
66+
}
6267
}

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"symfony/type-info": "^7.1.8|^8.0",
7171
"symfony/validator": "^7.4|^8.0",
7272
"symfony/workflow": "^7.3|^8.0",
73-
"symfony/yaml": "^6.4|^7.0|^8.0",
73+
"symfony/yaml": "^7.3|^8.0",
7474
"symfony/property-info": "^6.4|^7.0|^8.0",
7575
"symfony/json-streamer": "^7.3|^8.0",
7676
"symfony/uid": "^6.4|^7.0|^8.0",

0 commit comments

Comments
 (0)