public function ContainerBuilderTest::testfindTaggedServiceIds

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

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php, line 455

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testfindTaggedServiceIds() {
  $builder = new ContainerBuilder();
  $builder
    ->register('foo', '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');
}