3 namespace Drupal\Tests\token\Kernel;
5 use Drupal\views\Tests\ViewTestData;
6 use Drupal\views\Views;
9 * Test the views tokens.
13 class ViewsTest extends KernelTestBase {
20 public static $modules = ['views', 'block'];
23 * Views used by this test.
27 public static $testViews = ['token_views_test'];
32 protected function setUp() {
34 $this->installEntitySchema('user');
35 ViewTestData::createTestViews(get_class($this), ['token_module_test']);
39 * Tests path token replacements generated from a view without a path.
41 public function testTokenReplacementNoPath() {
42 $token_handler = \Drupal::token();
43 $view = Views::getView('token_views_test');
44 $view->setDisplay('block_1');
47 $this->assertSame('', $token_handler->replace('[view:url]', ['view' => $view]), 'Token [view:url] is empty for views without path.');