function ViewsConfigUpdaterTest::loadTestView

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php \Drupal\Tests\views\Kernel\ViewsConfigUpdaterTest::loadTestView()
  2. 10 core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php \Drupal\Tests\views\Kernel\ViewsConfigUpdaterTest::loadTestView()
  3. 11.x core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php \Drupal\Tests\views\Kernel\ViewsConfigUpdaterTest::loadTestView()

Loads a test view.

Parameters

string $view_id: The view config ID.

Return value

\Drupal\views\ViewEntityInterface A view entity object.

4 calls to ViewsConfigUpdaterTest::loadTestView()
ViewsConfigUpdaterTest::testNeedsEntityLinkUrlUpdate in core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php
@covers ::needsEntityLinkUrlUpdate
ViewsConfigUpdaterTest::testNeedsFieldNamesForMultivalueBaseFieldsUpdate in core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php
@covers ::needsMultivalueBaseFieldUpdate
ViewsConfigUpdaterTest::testNeedsOperatorUpdateDefaults in core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php
@covers ::needsOperatorDefaultsUpdate
ViewsConfigUpdaterTest::testUpdateAll in core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php
@covers ::updateAll

File

core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php, line 47

Class

ViewsConfigUpdaterTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21ViewsConfigUpdater.php/class/ViewsConfigUpdater/8.9.x" title="Provides a BC layer for modules providing old configurations." class="local">\Drupal\views\ViewsConfigUpdater</a>

Namespace

Drupal\Tests\views\Kernel

Code

protected function loadTestView($view_id) {
    // We just instantiate the test view from the raw configuration, as it may
    // not be possible to save it, due to its faulty schema.
    $config_dir = drupal_get_path('module', 'views') . '/tests/fixtures/update';
    $file_storage = new FileStorage($config_dir);
    $values = $file_storage->read($view_id);
    
    /** @var \Drupal\views\ViewEntityInterface $test_view */
    $test_view = $this->container
        ->get('entity_type.manager')
        ->getStorage('view')
        ->create($values);
    return $test_view;
}

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