You are here

public function ContainerBuilderTest::testfindTaggedServiceIds in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testfindTaggedServiceIds()

@covers Symfony\Component\DependencyInjection\ContainerBuilder::findTaggedServiceIds

File

vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php, line 510

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testfindTaggedServiceIds() {
  $builder = new ContainerBuilder();
  $builder
    ->register('foo', 'Bar\\FooClass')
    ->addTag('foo', array(
    'foo' => 'foo',
  ))
    ->addTag('bar', array(
    'bar' => 'bar',
  ))
    ->addTag('foo', array(
    'foofoo' => 'foofoo',
  ));
  $this
    ->assertEquals($builder
    ->findTaggedServiceIds('foo'), array(
    'foo' => array(
      array(
        'foo' => 'foo',
      ),
      array(
        'foofoo' => 'foofoo',
      ),
    ),
  ), '->findTaggedServiceIds() returns an array of service ids and its tag attributes');
  $this
    ->assertEquals(array(), $builder
    ->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services');
}