Skip to content
Permalink
Browse files

feature #22771 [Workflow] Removed deprecated features (lyrixx)

This PR was squashed before being merged into the 4.0-dev branch (closes #22771).

Discussion
----------

[Workflow] Removed deprecated features

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

---

Note: all commits are atomic

Commits
-------

3bed8f6 [Workflow] The `type` option of the `framework.workflows.*` configuration entries is `state_machine`
fd25777 [Workflow] Removed  FrameworkBundle/DependencyInjection/Compiler/ValidateWorkflowsPass
1ccbe0b [Workflow] Removed class name support in `WorkflowRegistry::add()` as second parameter
  • Loading branch information...
fabpot committed May 19, 2017
2 parents 31f74ca + 3bed8f6 commit a91a7de71ea0be5ab3f3f6fc04c0760ff06a3eb0
@@ -1,6 +1,12 @@
CHANGELOG
=========

4.0.0
-----

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

3.3.0
-----

@@ -47,7 +53,7 @@ CHANGELOG
`Symfony\Component\Validator\DependencyInjection\AddValidatorInitializersPass` instead
* Deprecated `AddConstraintValidatorsPass`, use
`Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass` instead
* Deprecated `ValidateWorkflowsPass`, use
* Deprecated `ValidateWorkflowsPass`, use
`Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` instead

3.2.0

This file was deleted.

@@ -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')
@@ -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();
@@ -41,7 +41,6 @@
),
),
'pull_request' => array(
'type' => 'state_machine',
'marking_store' => array(
'type' => 'single_state',
),

This file was deleted.

@@ -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>

This file was deleted.

@@ -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:

This file was deleted.

@@ -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');
@@ -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));
@@ -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.
@@ -1,6 +1,11 @@
CHANGELOG
=========

4.0.0
-----

* Removed class name support in `WorkflowRegistry::add()` as second parameter.

3.3.0
-----

@@ -12,7 +12,6 @@
namespace Symfony\Component\Workflow;
use Symfony\Component\Workflow\Exception\InvalidArgumentException;
use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy;
use Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface;
/**
@@ -24,15 +23,13 @@ class Registry
private $workflows = array();
/**
* @param Workflow $workflow
* @param string|SupportStrategyInterface $supportStrategy
* @param Workflow $workflow
* @param SupportStrategyInterface $supportStrategy
*/
public function add(Workflow $workflow, $supportStrategy)
{
if (!$supportStrategy instanceof SupportStrategyInterface) {
@trigger_error('Support of class name string was deprecated after version 3.2 and won\'t work anymore in 4.0.', E_USER_DEPRECATED);
$supportStrategy = new ClassInstanceSupportStrategy($supportStrategy);
throw new \InvalidArgumentException('The "supportStrategy" is not an instance of SupportStrategyInterface.');
}
$this->workflows[] = array($workflow, $supportStrategy);
@@ -64,7 +61,7 @@ public function get($subject, $workflowName = null)
return $matched;
}
private function supports(Workflow $workflow, $supportStrategy, $subject, $workflowName)
private function supports(Workflow $workflow, SupportStrategyInterface $supportStrategy, $subject, $workflowName)
{
if (null !== $workflowName && $workflowName !== $workflow->getName()) {
return false;
@@ -65,29 +65,6 @@ public function testGetWithNoMatch()
$this->assertSame('workflow1', $w1->getName());
}
/**
* @group legacy
*/
public function testGetWithSuccessLegacyStrategy()
{
$registry = new Registry();
$registry->add(new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow1'), Subject1::class);
$registry->add(new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow2'), Subject2::class);
$workflow = $registry->get(new Subject1());
$this->assertInstanceOf(Workflow::class, $workflow);
$this->assertSame('workflow1', $workflow->getName());
$workflow = $registry->get(new Subject1(), 'workflow1');
$this->assertInstanceOf(Workflow::class, $workflow);
$this->assertSame('workflow1', $workflow->getName());
$workflow = $registry->get(new Subject2(), 'workflow2');
$this->assertInstanceOf(Workflow::class, $workflow);
$this->assertSame('workflow2', $workflow->getName());
}
private function createSupportStrategy($supportedClassName)
{
$strategy = $this->getMockBuilder(SupportStrategyInterface::class)->getMock();

0 comments on commit a91a7de

Please sign in to comment.
You can’t perform that action at this time.