public function BasicFixedBlockTest::testDefaultContent in Fixed Block Content 8
Tests the default content export.
File
- tests/
src/ Functional/ BasicFixedBlockTest.php, line 29
Class
- BasicFixedBlockTest
- Tests the basic fixed block content functionality.
Namespace
Drupal\Tests\fixed_block_content\FunctionalCode
public function testDefaultContent() {
// Random content.
$random_content = $this
->randomString(128);
// Gets the block content. An empty one will be created.
$block_content = $this->fixedBlock
->getBlockContent();
// Sets the block content in the body field.
$block_content
->get('body')
->setValue($random_content);
// Import and save current block contents as the default content.
$this->fixedBlock
->importDefaultContent();
$this->fixedBlock
->save();
// Delete the block content.
$block_content
->delete();
// Gets the home page.
$this
->drupalGet('<front>');
// Default content is expected.
$this
->assertSession()
->pageTextContains($random_content);
}