You are here

public function ViewsTest::testTokenReplacementNoPath in Token 8

Tests path token replacements generated from a view without a path.

File

tests/src/Kernel/ViewsTest.php, line 41

Class

ViewsTest
Test the views tokens.

Namespace

Drupal\Tests\token\Kernel

Code

public function testTokenReplacementNoPath() {
  $token_handler = \Drupal::token();
  $view = Views::getView('token_views_test');
  $view
    ->setDisplay('block_1');
  $view
    ->execute();
  $this
    ->assertSame('', $token_handler
    ->replace('[view:url]', [
    'view' => $view,
  ]), 'Token [view:url] is empty for views without path.');
}