You are here

protected function ContainerMockTrait::mockContainer in Drupal 7 to 8/9 Module Upgrader 8

3 calls to ContainerMockTrait::mockContainer()
ContainerMockTrait::mockLogger in tests/src/Unit/ContainerMockTrait.php
ContainerMockTrait::mockTranslator in tests/src/Unit/ContainerMockTrait.php
TestBase::setUp in tests/src/Unit/TestBase.php
Mocks an entire module, called foo, in a virtual file system.

File

tests/src/Unit/ContainerMockTrait.php, line 18

Class

ContainerMockTrait
A trait for tests that need a mock container; contains (deprecated) methods to mock basic translation and logging services as well.

Namespace

Drupal\Tests\drupalmoduleupgrader\Unit

Code

protected function mockContainer() {
  if (empty($this->container)) {

    // Using a ContainerBuilder lets us simply stick services into the
    // container, which is a whole lot easier than mocking it!
    $this->container = new ContainerBuilder();
  }
}