protected function ContentHubEntityDependencyTest::setUp in Acquia Content Hub 8
Overrides UnitTestCase::setUp
File
- tests/src/ Unit/ ContentHubEntityDependencyTest.php, line 44 
Class
- ContentHubEntityDependencyTest
- PHPUnit for the ContentHubEntityDependency class.
Namespace
Drupal\Tests\acquia_contenthub\UnitCode
protected function setUp() {
  parent::setUp();
  // Setting up the Module Handler.
  $this->moduleHandler = $this
    ->createMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface');
  // Setting up the Container.
  $this->container = $this
    ->createMock('Drupal\\Core\\DependencyInjection\\Container');
  $this->container
    ->method('get')
    ->willReturnCallback(function ($name) {
    switch ($name) {
      case 'module_handler':
        return $this->moduleHandler;
    }
    return NULL;
  });
  \Drupal::setContainer($this->container);
}