Thanks to visit codestin.com
Credit goes to github.com

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
1 change: 1 addition & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CHANGELOG
* Add `rate_limiter` tags to rate limiter services
* Add `secrets:reveal` command
* Add `rate_limiter` option to `http_client.default_options` and `http_client.scoped_clients`
* Attach the workflow's configuration to the `workflow` tag

7.0
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
$workflowDefinition->replaceArgument(3, $name);
$workflowDefinition->replaceArgument(4, $workflow['events_to_dispatch']);

$workflowDefinition->addTag('workflow', ['name' => $name]);
$workflowDefinition->addTag('workflow', ['name' => $name, 'metadata' => $workflow['metadata']]);
if ('workflow' === $type) {
$workflowDefinition->addTag('workflow.workflow', ['name' => $name]);
} elseif ('state_machine' === $type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Webhook\Client\RequestParser;
use Symfony\Component\Webhook\Controller\WebhookController;
use Symfony\Component\Workflow;
use Symfony\Component\Workflow\Exception\InvalidDefinitionException;
use Symfony\Component\Workflow\Metadata\InMemoryMetadataStore;
use Symfony\Component\Workflow\WorkflowEvents;
Expand Down Expand Up @@ -302,7 +301,15 @@ public function testWorkflows()
$this->assertArrayHasKey('index_4', $args);
$this->assertNull($args['index_4'], 'Workflows has eventsToDispatch=null');

$this->assertSame(['workflow' => [['name' => 'article']], 'workflow.workflow' => [['name' => 'article']]], $container->getDefinition('workflow.article')->getTags());
$tags = $container->getDefinition('workflow.article')->getTags();
$this->assertArrayHasKey('workflow', $tags);
$this->assertArrayHasKey('workflow.workflow', $tags);
$this->assertSame([['name' => 'article']], $tags['workflow.workflow']);
$this->assertSame('article', $tags['workflow'][0]['name'] ?? null);
$this->assertSame([
'title' => 'article workflow',
'description' => 'workflow for articles',
], $tags['workflow'][0]['metadata'] ?? null);

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

Expand Down Expand Up @@ -333,7 +340,14 @@ public function testWorkflows()
$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->assertSame(['workflow' => [['name' => 'pull_request']], 'workflow.state_machine' => [['name' => 'pull_request']]], $container->getDefinition('state_machine.pull_request')->getTags());
$tags = $container->getDefinition('state_machine.pull_request')->getTags();
$this->assertArrayHasKey('workflow', $tags);
$this->assertArrayHasKey('workflow.state_machine', $tags);
$this->assertSame([['name' => 'pull_request']], $tags['workflow.state_machine']);
$this->assertSame('pull_request', $tags['workflow'][0]['name'] ?? null);
$this->assertSame([
'title' => 'workflow title',
], $tags['workflow'][0]['metadata'] ?? null);

$stateMachineDefinition = $container->getDefinition('state_machine.pull_request.definition');

Expand All @@ -357,7 +371,7 @@ public function testWorkflows()
$this->assertSame('state_machine.pull_request.metadata_store', (string) $metadataStoreReference);

$metadataStoreDefinition = $container->getDefinition('state_machine.pull_request.metadata_store');
$this->assertSame(Workflow\Metadata\InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());

$workflowMetadata = $metadataStoreDefinition->getArgument(0);
Expand Down