Skip to content

Commit

Permalink
[Workflow] The type option of the framework.workflows.* configura…
Browse files Browse the repository at this point in the history
…tion entries is `state_machine`
  • Loading branch information
lyrixx committed May 19, 2017
1 parent fd25777 commit 3bed8f6
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 75 deletions.
3 changes: 2 additions & 1 deletion src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Expand Up @@ -4,7 +4,8 @@ CHANGELOG
4.0.0
-----

* Removed `ValidateWorkflowsPass`
* Removed `ValidateWorkflowsPass`
* The default `type` option of the `framework.workflows.*` configuration entries is `state_machine`

3.3.0
-----
Expand Down
Expand Up @@ -230,6 +230,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
->end()
->enumNode('type')
->values(array('workflow', 'state_machine'))
->defaultValue('state_machine')
->end()
->arrayNode('marking_store')
->fixXmlConfig('argument')
Expand Down
Expand Up @@ -498,10 +498,6 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
$registryDefinition = $container->getDefinition('workflow.registry');

foreach ($workflows as $name => $workflow) {
if (!array_key_exists('type', $workflow)) {
$workflow['type'] = 'workflow';
@trigger_error(sprintf('The "type" option of the "framework.workflows.%s" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.', $name), E_USER_DEPRECATED);
}
$type = $workflow['type'];

$transitions = array();
Expand Down
Expand Up @@ -41,7 +41,6 @@
),
),
'pull_request' => array(
'type' => 'state_machine',
'marking_store' => array(
'type' => 'single_state',
),
Expand Down

This file was deleted.

Expand Up @@ -39,7 +39,7 @@
</framework:transition>
</framework:workflow>

<framework:workflow name="pull_request" type="state_machine" initial-place="start">
<framework:workflow name="pull_request" initial-place="start">
<framework:marking-store type="single_state"/>
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
<framework:place>start</framework:place>
Expand Down

This file was deleted.

Expand Up @@ -28,7 +28,6 @@ framework:
from: [approved_by_journalist, approved_by_spellchecker]
to: [published]
pull_request:
type: state_machine
marking_store:
type: single_state
supports:
Expand Down

This file was deleted.

Expand Up @@ -154,8 +154,9 @@ public function testWorkflows()
{
$container = $this->createContainerFromFile('workflows');

$this->assertTrue($container->hasDefinition('workflow.article', 'Workflow is registered as a service'));
$this->assertTrue($container->hasDefinition('workflow.article.definition', 'Workflow definition is registered as a service'));
$this->assertTrue($container->hasDefinition('workflow.article'), 'Workflow is registered as a service');
$this->assertSame('workflow.abstract', $container->getDefinition('workflow.article')->getParent());
$this->assertTrue($container->hasDefinition('workflow.article.definition'), 'Workflow definition is registered as a service');

$workflowDefinition = $container->getDefinition('workflow.article.definition');

Expand All @@ -173,8 +174,9 @@ public function testWorkflows()
);
$this->assertSame(array('workflow.definition' => array(array('name' => 'article', 'type' => 'workflow', 'marking_store' => 'multiple_state'))), $workflowDefinition->getTags());

$this->assertTrue($container->hasDefinition('state_machine.pull_request', 'State machine is registered as a service'));
$this->assertTrue($container->hasDefinition('state_machine.pull_request.definition', 'State machine definition is registered as a service'));
$this->assertTrue($container->hasDefinition('state_machine.pull_request'), 'State machine is registered as a service');
$this->assertSame('state_machine.abstract', $container->getDefinition('state_machine.pull_request')->getParent());
$this->assertTrue($container->hasDefinition('state_machine.pull_request.definition'), 'State machine definition is registered as a service');
$this->assertCount(4, $workflowDefinition->getArgument(1));
$this->assertSame('draft', $workflowDefinition->getArgument(2));

Expand Down Expand Up @@ -207,15 +209,6 @@ public function testWorkflows()
$this->assertGreaterThan(0, count($registryDefinition->getMethodCalls()));
}

/**
* @group legacy
* @expectedDeprecation The "type" option of the "framework.workflows.missing_type" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.
*/
public function testDeprecatedWorkflowMissingType()
{
$container = $this->createContainerFromFile('workflows_without_type');
}

/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage "type" and "service" cannot be used together.
Expand Down

0 comments on commit 3bed8f6

Please sign in to comment.