public function ContainerTest::test_get_factoryClassNew in Service Container 7
Same name and namespace in other branches
- 7.2 tests/src/DependencyInjection/ContainerTest.php \Drupal\Tests\service_container\DependencyInjection\ContainerTest::test_get_factoryClassNew()
Tests that Container::get() for factories via class works (Symfony 2.7.0). @covers ::get()
File
- tests/
src/ DependencyInjection/ ContainerTest.php, line 305 - Contains \Drupal\Tests\service_container\DependencyInjection\ContainerTest
Class
- ContainerTest
- @coversDefaultClass \Drupal\service_container\DependencyInjection\Container @group dic
Namespace
Drupal\Tests\service_container\DependencyInjectionCode
public function test_get_factoryClassNew() {
$service = $this->container
->get('service.provider');
$factory_service = $this->container
->get('factory_class_new');
$this
->assertInstanceOf(get_class($service), $factory_service);
$this
->assertEquals('bar', $factory_service
->getSomeParameter(), 'Correct parameter was passed via the factory class instantiation.');
$this
->assertEquals($this->container, $factory_service
->getContainer(), 'Container was injected via setter injection.');
}