You are here

protected function FreelinkingManagerTest::setUp in Freelinking 8.3

Same name and namespace in other branches
  1. 4.0.x tests/src/Unit/FreelinkingManagerTest.php \Drupal\Tests\freelinking\Unit\FreelinkingManagerTest::setUp()

Overrides UnitTestCase::setUp

File

tests/src/Unit/FreelinkingManagerTest.php, line 35

Class

FreelinkingManagerTest
Tests the freelinking plugin manager.

Namespace

Drupal\Tests\freelinking\Unit

Code

protected function setUp() {

  // Use a null cache backend to prevent caching.
  $cacheBackend = new NullBackend('freelinking');

  // Mock the module handler and language objects.
  $moduleProphet = $this
    ->prophesize('\\Drupal\\Core\\Extension\\ModuleHandlerInterface');
  $moduleHandler = $moduleProphet
    ->reveal();
  $languageProphet = $this
    ->prophesize('\\Drupal\\Core\\Language\\LanguageInterface');
  $this->language = $languageProphet
    ->reveal();
  $languageManagerProphet = $this
    ->prophesize('\\Drupal\\Core\\Language\\LanguageManagerInterface');
  $languageManagerProphet
    ->getLanguage('en')
    ->willReturn($this->language);
  $languageManager = $languageManagerProphet
    ->reveal();
  $namespaces = new \ArrayObject();
  $this->pluginManager = new FreelinkingManager($namespaces, $cacheBackend, $moduleHandler, $languageManager);
}