private function UnitTestBase::prepareContainer in Select (or other) 4.x
Same name and namespace in other branches
- 8 tests/src/Unit/UnitTestBase.php \Drupal\Tests\select_or_other\Unit\UnitTestBase::prepareContainer()
Prepares a mocked service container.
1 call to UnitTestBase::prepareContainer()
- UnitTestBase::setUp in tests/
src/ Unit/ UnitTestBase.php
File
- tests/
src/ Unit/ UnitTestBase.php, line 41
Class
Namespace
Drupal\Tests\select_or_other\UnitCode
private function prepareContainer() {
$container_class = 'Drupal\\Core\\DependencyInjection\\Container';
$methods = get_class_methods($container_class);
/** @var ContainerInterface $container */
$this->containerMock = $container = $this
->getMockBuilder($container_class)
->disableOriginalConstructor()
->setMethods($methods)
->getMock();
\Drupal::setContainer($container);
$this->containerMock
->method('get')
->willReturnCallback([
$this,
'containerMockGetServiceCallback',
]);
}