Skip to content

Commit f30fbe2

Browse files
committed
[FrameworkBundle] Fix error in xsd which prevent to register more than one metadata
1 parent 5c6d483 commit f30fbe2

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@
348348

349349
<xsd:complexType name="metadata">
350350
<xsd:sequence>
351-
<xsd:any minOccurs="0" processContents="lax"/>
351+
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
352352
</xsd:sequence>
353353
</xsd:complexType>
354354

Tests/DependencyInjection/Fixtures/php/workflows.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
FrameworkExtensionTest::class,
1111
],
1212
'initial_marking' => ['draft'],
13+
'metadata' => [
14+
'title' => 'article workflow',
15+
'description' => 'workflow for articles'
16+
],
1317
'places' => [
1418
'draft',
1519
'wait_for_journalist',

Tests/DependencyInjection/Fixtures/xml/workflows.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
<framework:from>approved_by_spellchecker</framework:from>
3636
<framework:to>published</framework:to>
3737
</framework:transition>
38+
<framework:metadata>
39+
<framework:title>article workflow</framework:title>
40+
<framework:description>workflow for articles</framework:description>
41+
</framework:metadata>
3842
</framework:workflow>
3943

4044
<framework:workflow name="pull_request">

Tests/DependencyInjection/Fixtures/yml/workflows.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ framework:
55
supports:
66
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
77
initial_marking: [draft]
8+
metadata:
9+
title: article workflow
10+
description: workflow for articles
811
places:
912
# simple format
1013
- draft

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
use Symfony\Component\Validator\Mapping\Loader\PropertyInfoLoader;
5656
use Symfony\Component\Validator\Util\LegacyTranslatorProxy;
5757
use Symfony\Component\Workflow;
58+
use Symfony\Component\Workflow\Metadata\InMemoryMetadataStore;
5859
use Symfony\Contracts\Translation\TranslatorInterface;
5960

6061
abstract class FrameworkExtensionTest extends TestCase
@@ -242,6 +243,12 @@ public function testWorkflows()
242243
);
243244
$this->assertCount(4, $workflowDefinition->getArgument(1));
244245
$this->assertSame(['draft'], $workflowDefinition->getArgument(2));
246+
$metadataStoreDefinition = $workflowDefinition->getArgument(3);
247+
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
248+
$this->assertSame([
249+
'title' => 'article workflow',
250+
'description' => 'workflow for articles',
251+
], $metadataStoreDefinition->getArgument(0));
245252

246253
$this->assertTrue($container->hasDefinition('state_machine.pull_request'), 'State machine is registered as a service');
247254
$this->assertSame('state_machine.abstract', $container->getDefinition('state_machine.pull_request')->getParent());
@@ -266,7 +273,7 @@ public function testWorkflows()
266273

267274
$metadataStoreDefinition = $stateMachineDefinition->getArgument(3);
268275
$this->assertInstanceOf(Definition::class, $metadataStoreDefinition);
269-
$this->assertSame(Workflow\Metadata\InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
276+
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
270277

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

0 commit comments

Comments
 (0)