function ZfExtensionManagerSfContainerTest::testPrefix

Same name in this branch
  1. 9 core/tests/Drupal/Tests/Component/Bridge/ZfExtensionManagerSfContainerTest.php \Drupal\Tests\Component\Bridge\ZfExtensionManagerSfContainerTest::testPrefix()
Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Bridge/ZfExtensionManagerSfContainerTest.php \Drupal\Tests\Component\Bridge\ZfExtensionManagerSfContainerTest::testPrefix()

@covers ::__construct @covers ::has @covers ::get

File

core/modules/aggregator/tests/src/Unit/ZfExtensionManagerSfContainerTest.php, line 86

Class

ZfExtensionManagerSfContainerTest
@coversDefaultClass \Drupal\aggregator\ZfExtensionManagerSfContainer @group aggregator @group legacy

Namespace

Drupal\Tests\aggregator\Unit

Code

public function testPrefix() {
    $service = new \stdClass();
    $service->value = 'my_value';
    $container = new ContainerBuilder();
    $container->set('foo.bar', $service);
    $bridge = new ZfExtensionManagerSfContainer('foo.');
    $bridge->setContainer($container);
    $this->assertTrue($bridge->has('bar'));
    $this->assertFalse($bridge->has('baz'));
    $this->assertEquals($service, $bridge->get('bar'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.