You are here

protected function ViewsDataTest::setUp in Drupal 8

Same name in this branch
  1. 8 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::setUp()
  2. 8 core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php \Drupal\Tests\options\Kernel\Views\ViewsDataTest::setUp()

Overrides UnitTestCase::setUp

File

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

Class

ViewsDataTest
@coversDefaultClass \Drupal\views\ViewsData @group views

Namespace

Drupal\Tests\views\Unit

Code

protected function setUp() {
  $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')
    ->will($this
    ->returnValue(new Language([
    'id' => 'en',
  ])));
  $this->viewsData = new ViewsData($this->cacheBackend, $this->configFactory, $this->moduleHandler, $this->languageManager);
}