function ArgumentDefaultTest::testArgumentDefaultUrlGeneration
Tests the more line generation if a default argument is provided.
File
- 
              core/modules/ views/ tests/ src/ Functional/ Plugin/ ArgumentDefaultTest.php, line 199 
Class
- ArgumentDefaultTest
- Tests pluggable argument_default for views.
Namespace
Drupal\Tests\views\Functional\PluginCode
public function testArgumentDefaultUrlGeneration() : void {
  // Create a user that has permission to place a view block.
  $permissions = [
    'administer views',
    'administer blocks',
    'bypass node access',
    'access user profiles',
    'view all revisions',
  ];
  $views_admin = $this->drupalCreateUser($permissions);
  $this->drupalLogin($views_admin);
  // Create nodes where should show themselves again as view block.
  $node_type = NodeType::create([
    'type' => 'page',
    'name' => 'Page',
  ]);
  $node_type->save();
  $node = Node::create([
    'title' => 'Test node 1',
    'type' => 'page',
  ]);
  $node->save();
  // Place the block, visit the page that displays the block, and check that
  // the more link takes the node ID into account and does not ignore
  // the default argument.
  $this->drupalPlaceBlock("views_block:test_argument_default_node_with_page-block_1", [
    'id' => 'view_block_id',
  ]);
  $this->drupalGet('node/' . $node->id());
  $this->assertSession()
    ->linkByHrefExists('/test-argument-default/' . $node->id());
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
