protected function FreelinkingManagerTest::setUp in Freelinking 4.0.x
Same name and namespace in other branches
- 8.3 tests/src/Unit/FreelinkingManagerTest.php \Drupal\Tests\freelinking\Unit\FreelinkingManagerTest::setUp()
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ FreelinkingManagerTest.php, line 38
Class
- FreelinkingManagerTest
- Tests the freelinking plugin manager.
Namespace
Drupal\Tests\freelinking\UnitCode
protected function setUp() : void {
// 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);
}