You are here

public function BlockContentPageViewTest::testPageEdit in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block_content/tests/src/Functional/BlockContentPageViewTest.php \Drupal\Tests\block_content\Functional\BlockContentPageViewTest::testPageEdit()
  2. 9 core/modules/block_content/tests/src/Functional/BlockContentPageViewTest.php \Drupal\Tests\block_content\Functional\BlockContentPageViewTest::testPageEdit()

Checks block edit and fallback functionality.

File

core/modules/block_content/tests/src/Functional/BlockContentPageViewTest.php, line 27

Class

BlockContentPageViewTest
Create a block and test block access by attempting to view the block.

Namespace

Drupal\Tests\block_content\Functional

Code

public function testPageEdit() {
  $this
    ->drupalLogin($this->adminUser);
  $block = $this
    ->createBlockContent();

  // Attempt to view the block.
  $this
    ->drupalGet('block-content/' . $block
    ->id());

  // Ensure user was able to view the block.
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->drupalGet('<front>');
  $this
    ->assertSession()
    ->pageTextContains('This block is broken or missing. You may be missing content or you might need to enable the original module.');
}