function ViewsDataTest::testGetEmptyKey

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

Tests that getting data with an empty key throws an exception.

@covers ::get @dataProvider providerTestGetEmptyKey

File

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

Class

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

Namespace

Drupal\Tests\views\Unit

Code

public function testGetEmptyKey($key) : void {
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage('A valid cache entry key is required. Use getAll() to get all table data.');
    $this->viewsData
        ->get($key);
}

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