Skip to content

[FrameworkBundle] Fix xsd definition which prevent to add more than one workflow metadata #38202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@

<xsd:complexType name="metadata">
<xsd:sequence>
<xsd:any minOccurs="0" processContents="lax"/>
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xsd:sequence>
</xsd:complexType>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
FrameworkExtensionTest::class,
],
'initial_marking' => ['draft'],
'metadata' => [
'title' => 'article workflow',
'description' => 'workflow for articles'
],
'places' => [
'draft',
'wait_for_journalist',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<framework:from>approved_by_spellchecker</framework:from>
<framework:to>published</framework:to>
</framework:transition>
<framework:metadata>
<framework:title>article workflow</framework:title>
<framework:description>workflow for articles</framework:description>
</framework:metadata>
</framework:workflow>

<framework:workflow name="pull_request">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ framework:
supports:
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
initial_marking: [draft]
metadata:
title: article workflow
description: workflow for articles
places:
# simple format
- draft
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
use Symfony\Component\Validator\Mapping\Loader\PropertyInfoLoader;
use Symfony\Component\Validator\Util\LegacyTranslatorProxy;
use Symfony\Component\Workflow;
use Symfony\Component\Workflow\Metadata\InMemoryMetadataStore;
use Symfony\Contracts\Translation\TranslatorInterface;

abstract class FrameworkExtensionTest extends TestCase
Expand Down Expand Up @@ -242,6 +243,12 @@ public function testWorkflows()
);
$this->assertCount(4, $workflowDefinition->getArgument(1));
$this->assertSame(['draft'], $workflowDefinition->getArgument(2));
$metadataStoreDefinition = $workflowDefinition->getArgument(3);
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
$this->assertSame([
'title' => 'article workflow',
'description' => 'workflow for articles',
], $metadataStoreDefinition->getArgument(0));

$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());
Expand All @@ -266,7 +273,7 @@ public function testWorkflows()

$metadataStoreDefinition = $stateMachineDefinition->getArgument(3);
$this->assertInstanceOf(Definition::class, $metadataStoreDefinition);
$this->assertSame(Workflow\Metadata\InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());

$workflowMetadata = $metadataStoreDefinition->getArgument(0);
$this->assertSame(['title' => 'workflow title'], $workflowMetadata);
Expand Down