[FrameworkBundle] [Workflow] Fix service marking store configuration

This commit is contained in:
fduch 2016-12-05 15:52:39 +03:00 committed by Nicolas Grekas
parent a28c522790
commit 3289b10d9f
5 changed files with 50 additions and 1 deletions

View File

@ -268,7 +268,7 @@ class Configuration implements ConfigurationInterface
->thenInvalid('"type" and "service" cannot be used together.')
->end()
->validate()
->ifTrue(function ($v) { return isset($v['arguments']) && isset($v['service']); })
->ifTrue(function ($v) { return !empty($v['arguments']) && isset($v['service']); })
->thenInvalid('"arguments" and "service" cannot be used together.')
->end()
->end()

View File

@ -88,5 +88,23 @@ $container->loadFromExtension('framework', array(
),
),
),
'service_marking_store_workflow' => array(
'marking_store' => array(
'service' => 'workflow_service',
),
'supports' => array(
FrameworkExtensionTest::class,
),
'places' => array(
'first',
'last',
),
'transitions' => array(
'go' => array(
'from' => 'first',
'to' => 'last',
),
),
),
),
));

View File

@ -79,5 +79,16 @@
<framework:to>review</framework:to>
</framework:transition>
</framework:workflow>
<framework:workflow name="service_marking_store_workflow">
<framework:marking-store service="workflow_service"/>
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
<framework:place>first</framework:place>
<framework:place>last</framework:place>
<framework:transition name="go">
<framework:from>first</framework:from>
<framework:to>last</framework:to>
</framework:transition>
</framework:workflow>
</framework:config>
</container>

View File

@ -63,3 +63,17 @@ framework:
reopen:
from: closed
to: review
service_marking_store_workflow:
marking_store:
service: workflow_service
supports:
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
places:
- first
- last
transitions:
go:
from:
- first
to:
- last

View File

@ -165,6 +165,12 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertSame(array('workflow.definition' => array(array('name' => 'pull_request', 'type' => 'state_machine', 'marking_store' => 'single_state'))), $stateMachineDefinition->getTags());
$this->assertCount(9, $stateMachineDefinition->getArgument(1));
$this->assertSame('start', $stateMachineDefinition->getArgument(2));
$serviceMarkingStoreWorkflowDefinition = $container->getDefinition('workflow.service_marking_store_workflow');
/** @var Reference $markingStoreRef */
$markingStoreRef = $serviceMarkingStoreWorkflowDefinition->getArgument(1);
$this->assertInstanceOf(Reference::class, $markingStoreRef);
$this->assertEquals('workflow_service', (string) $markingStoreRef);
}
/**