class BlockContentPageViewTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/block_content/tests/src/Functional/BlockContentPageViewTest.php \Drupal\Tests\block_content\Functional\BlockContentPageViewTest
- 9 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 extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\block_content\Functional\BlockContentTestBase
- class \Drupal\Tests\block_content\Functional\BlockContentPageViewTest
- class \Drupal\Tests\block_content\Functional\BlockContentTestBase
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.');
}
}