function ViewsDataTest::setUp

Same name in this branch
  1. 9 core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php \Drupal\Tests\options\Kernel\Views\ViewsDataTest::setUp()
Same name and namespace in other branches
  1. 8.9.x core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php \Drupal\Tests\options\Kernel\Views\ViewsDataTest::setUp()
  2. 8.9.x core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::setUp()
  3. 10 core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php \Drupal\Tests\options\Kernel\Views\ViewsDataTest::setUp()
  4. 10 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::setUp()
  5. 11.x core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php \Drupal\Tests\options\Kernel\Views\ViewsDataTest::setUp()
  6. 11.x core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/views/tests/src/Unit/ViewsDataTest.php, line 61

Class

ViewsDataTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21ViewsData.php/class/ViewsData/9" title="Class to manage and lazy load cached views data." class="local">\Drupal\views\ViewsData</a> @group views

Namespace

Drupal\Tests\views\Unit

Code

protected function setUp() : void {
    $this->cacheTagsInvalidator = $this->createMock('Drupal\\Core\\Cache\\CacheTagsInvalidatorInterface');
    $this->cacheBackend = $this->createMock('Drupal\\Core\\Cache\\CacheBackendInterface');
    $this->getContainerWithCacheTagsInvalidator($this->cacheTagsInvalidator);
    $configs = [];
    $configs['views.settings']['skip_cache'] = FALSE;
    $this->configFactory = $this->getConfigFactoryStub($configs);
    $this->moduleHandler = $this->createMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
    $this->languageManager = $this->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
    $this->languageManager
        ->expects($this->any())
        ->method('getCurrentLanguage')
        ->willReturn(new Language([
        'id' => 'en',
    ]));
    $this->viewsData = new ViewsData($this->cacheBackend, $this->configFactory, $this->moduleHandler, $this->languageManager);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.