public function FixedBlockAdminTest::doTestImportConfirmForm in Fixed Block Content 8
Tests the default content import confirm form.
See also
\Drupal\fixed_block_content\Form\ImportConfirmForm
1 call to FixedBlockAdminTest::doTestImportConfirmForm()
- FixedBlockAdminTest::testAdmin in tests/
src/ Functional/ FixedBlockAdminTest.php - Full admin test sequence.
File
- tests/
src/ Functional/ FixedBlockAdminTest.php, line 86
Class
- FixedBlockAdminTest
- Tests the fixed block content admin.
Namespace
Drupal\Tests\fixed_block_content\FunctionalCode
public function doTestImportConfirmForm() {
// Gets the block content.
$block_content = $this->fixedBlock
->getBlockContent();
// Set random content on its body field.
$block_content
->get('body')
->setValue($this->randomContent);
$block_content
->save();
// Go to import (save into fixed) default content page.
$this
->drupalGet('admin/structure/block');
$this
->clickLink('Custom block library');
$this
->clickLink('Fixed blocks');
$this
->clickLink('Set contents as default');
$this
->assertText('Are you sure you want to set the Basic fixed current content as the default?');
// Confirm the form.
$this
->drupalPostForm(NULL, [], 'Confirm');
// Update the fixed block content object.
$this->fixedBlock = $this->container
->get('entity_type.manager')
->getStorage('fixed_block_content')
->load('basic_fixed');
// The body content must be in the the default content.
if (method_exists($this, 'assertStringContainsString')) {
// PHPUnit >= 7.5.0.
$this
->assertStringContainsString($this->randomContent, $this->fixedBlock
->get('default_content'));
}
else {
$this
->assertContains($this->randomContent, $this->fixedBlock
->get('default_content'));
}
}