You are here

public function FixedBlockAdminTest::doTestExportConfirmFormWithDefaultContent in Fixed Block Content 8

Tests the default content export confirm form.

See also

\Drupal\fixed_block_content\Form\ExportConfirmForm

1 call to FixedBlockAdminTest::doTestExportConfirmFormWithDefaultContent()
FixedBlockAdminTest::testAdmin in tests/src/Functional/FixedBlockAdminTest.php
Full admin test sequence.

File

tests/src/Functional/FixedBlockAdminTest.php, line 119

Class

FixedBlockAdminTest
Tests the fixed block content admin.

Namespace

Drupal\Tests\fixed_block_content\Functional

Code

public function doTestExportConfirmFormWithDefaultContent() {

  // Delete the current block content.
  $block_content = $this->fixedBlock
    ->getBlockContent(FALSE);
  $block_content
    ->delete();

  // Go to export (restore) block with the default content page.
  $this
    ->drupalGet('admin/structure/block/block-content/fixed-block-content/manage/basic_fixed/export');
  $this
    ->assertText('Are you sure you want to restore the Basic fixed to its default content?');
  $this
    ->drupalPostForm(NULL, [], 'Confirm');

  // A new block must has been created.
  $block_content = $this->fixedBlock
    ->getBlockContent(FALSE);
  $this
    ->assertNotNull($block_content);

  // Check that the body fields contains the expected default content.
  $this
    ->assertEquals($block_content
    ->get('body')
    ->getString(), $this->randomContent);
}