function LocalActionTest::testAddContentBlockLink

Tests the block_content_add_action link.

File

core/modules/block_content/tests/src/Functional/LocalActionTest.php, line 31

Class

LocalActionTest
Tests block_content local action links.

Namespace

Drupal\Tests\block_content\Functional

Code

public function testAddContentBlockLink() : void {
  // Verify that the link takes you straight to the block form if there's only
  // one type.
  $this->drupalGet('/admin/content/block');
  $this->clickLink('Add content block');
  $this->assertSession()
    ->statusCodeEquals(200);
  $this->assertSession()
    ->addressEquals('/block/add/basic');
  $type = $this->randomMachineName();
  $this->createBlockContentType([
    'id' => $type,
    'label' => $type,
  ]);
  // Verify that the link takes you to the block add page if there's more than
  // one type.
  $this->drupalGet('/admin/content/block');
  $this->clickLink('Add content block');
  $this->assertSession()
    ->statusCodeEquals(200);
  $this->assertSession()
    ->addressEquals('/block/add');
}

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