function ViewsDataTest::setupMockedModuleHandler

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::setupMockedModuleHandler()
  2. 8.9.x core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::setupMockedModuleHandler()
  3. 10 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::setupMockedModuleHandler()

Mocks the basic module handler used for the test.

7 calls to ViewsDataTest::setupMockedModuleHandler()
ViewsDataTest::testCacheCallsWithoutWarmCacheAndGetAllTables in core/modules/views/tests/src/Unit/ViewsDataTest.php
Tests the cache calls for all views data without a warm cache.
ViewsDataTest::testCacheCallsWithSameTableMultipleTimes in core/modules/views/tests/src/Unit/ViewsDataTest.php
Tests the cache backend behavior with requesting the same table multiple.
ViewsDataTest::testFetchBaseTables in core/modules/views/tests/src/Unit/ViewsDataTest.php
Tests the fetchBaseTables() method.
ViewsDataTest::testFullGetCache in core/modules/views/tests/src/Unit/ViewsDataTest.php
Tests the caching of the full views data.
ViewsDataTest::testGetOnFirstCall in core/modules/views/tests/src/Unit/ViewsDataTest.php
Tests fetching all the views data without a static cache.

... See full list

File

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

Class

ViewsDataTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21ViewsData.php/class/ViewsData/11.x" 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 setupMockedModuleHandler() : void {
    $this->moduleHandler
        ->expects($this->atLeastOnce())
        ->method('invokeAllWith')
        ->with('views_data')
        ->willReturnCallback(function (string $hook, callable $callback) {
        $callback(\Closure::fromCallable([
            $this,
            'viewsData',
        ]), 'views_test_data');
    });
}

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