class BlockContentPageViewTest
Same name and namespace in other branches
- 11.x core/modules/block_content/tests/src/Functional/BlockContentPageViewTest.php \Drupal\Tests\block_content\Functional\BlockContentPageViewTest
- 10 core/modules/block_content/tests/src/Functional/BlockContentPageViewTest.php \Drupal\Tests\block_content\Functional\BlockContentPageViewTest
- 8.9.x core/modules/block_content/tests/src/Functional/BlockContentPageViewTest.php \Drupal\Tests\block_content\Functional\BlockContentPageViewTest
Create a block and test block access by attempting to view the block.
@group block_content
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\block_content\Functional\BlockContentTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\block_content\Functional\BlockContentPageViewTest extends \Drupal\Tests\block_content\Functional\BlockContentTestBase
- class \Drupal\Tests\block_content\Functional\BlockContentTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of BlockContentPageViewTest
File
-
core/
modules/ block_content/ tests/ src/ Functional/ BlockContentPageViewTest.php, line 10
Namespace
Drupal\Tests\block_content\FunctionalView source
class BlockContentPageViewTest extends BlockContentTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'block_content_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Checks block edit and fallback functionality.
*/
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.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.