Enhancing integration test to show that "override" tags always show up first

This commit is contained in:
Ryan Weaver 2017-04-12 10:34:49 -04:00
parent 9950b90bb6
commit e9b96e5f44
2 changed files with 11 additions and 6 deletions

View File

@ -135,7 +135,7 @@ class IntegrationTest extends TestCase
// all tags are kept // all tags are kept
$this->assertEquals( $this->assertEquals(
array( array(
'foo_tag' => array(array('priority' => 100), array()), 'foo_tag' => array(array('tag_option' => 'from_service'), array('tag_option' => 'from_instanceof')),
'bar_tag' => array(array()), 'bar_tag' => array(array()),
), ),
$simpleService->getTags() $simpleService->getTags()
@ -169,10 +169,10 @@ class IntegrationTest extends TestCase
// tags inherit like normal // tags inherit like normal
$this->assertEquals( $this->assertEquals(
array( array(
'foo_tag' => array(array('priority' => 100), array()), 'foo_tag' => array(array('tag_option' => 'from_child_def'), array('tag_option' => 'from_parent_def'), array('tag_option' => 'from_instanceof')),
'bar_tag' => array(array()), 'bar_tag' => array(array()),
), ),
$simpleService->getTags() $childDef2->getTags()
); );
} }
} }

View File

@ -8,7 +8,7 @@ services:
autowire: false autowire: false
shared: false shared: false
tags: tags:
- { name: foo_tag } - { name: foo_tag, tag_option: from_instanceof }
calls: calls:
- [setSunshine, [bright]] - [setSunshine, [bright]]
@ -20,8 +20,8 @@ services:
service_simple: service_simple:
class: Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStub class: Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStub
tags: tags:
- { name: foo_tag, priority: 100 } - { name: foo_tag, tag_option: from_service }
# calls from instanceof are kept, but this comes later # calls from instanceof are kept, but this comes later
calls: calls:
- [enableSummer, [true]] - [enableSummer, [true]]
- [setSunshine, [warm]] - [setSunshine, [warm]]
@ -43,7 +43,12 @@ services:
parent_service_with_class: parent_service_with_class:
abstract: true abstract: true
class: Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStub class: Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTestStub
tags:
- { name: foo_tag, tag_option: from_parent_def }
child_service_with_parent_instanceof: child_service_with_parent_instanceof:
parent: parent_service_with_class parent: parent_service_with_class
shared: true shared: true
inherit_tags: true
tags:
- { name: foo_tag, tag_option: from_child_def }