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
$this->assertEquals(
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()),
),
$simpleService->getTags()
@ -169,10 +169,10 @@ class IntegrationTest extends TestCase
// tags inherit like normal
$this->assertEquals(
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()),
),
$simpleService->getTags()
$childDef2->getTags()
);
}
}

View File

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