You are here

public function EditorUpdateTest::testEditorUpdate8001 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/editor/src/Tests/Update/EditorUpdateTest.php \Drupal\editor\Tests\Update\EditorUpdateTest::testEditorUpdate8001()

Tests editor_update_8001().

See also

editor_update_8001()

File

core/modules/editor/src/Tests/Update/EditorUpdateTest.php, line 35
Contains \Drupal\editor\Tests\Update\EditorUpdateTest.

Class

EditorUpdateTest
Tests Editor module database updates.

Namespace

Drupal\editor\Tests\Update

Code

public function testEditorUpdate8001() {

  /** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
  $config_factory = $this->container
    ->get('config.factory');
  $format_basic_html = $config_factory
    ->get('filter.format.basic_html');
  $editor_basic_html = $config_factory
    ->get('editor.editor.basic_html');
  $format_full_html = $config_factory
    ->get('filter.format.full_html');
  $editor_full_html = $config_factory
    ->get('editor.editor.full_html');

  // Checks if the 'basic_html' format and editor statuses differ.
  $this
    ->assertTrue($format_basic_html
    ->get('status'));
  $this
    ->assertFalse($editor_basic_html
    ->get('status'));
  $this
    ->assertNotIdentical($format_basic_html
    ->get('status'), $editor_basic_html
    ->get('status'));

  // Checks if the 'full_html' format and editor statuses differ.
  $this
    ->assertFalse($format_full_html
    ->get('status'));
  $this
    ->assertTrue($editor_full_html
    ->get('status'));
  $this
    ->assertNotIdentical($format_full_html
    ->get('status'), $editor_full_html
    ->get('status'));

  // Run updates.
  $this
    ->runUpdates();

  // Reload text formats and editors.
  $format_basic_html = $config_factory
    ->get('filter.format.basic_html');
  $editor_basic_html = $config_factory
    ->get('editor.editor.basic_html');
  $format_full_html = $config_factory
    ->get('filter.format.full_html');
  $editor_full_html = $config_factory
    ->get('editor.editor.full_html');

  // Checks if the 'basic_html' format and editor statuses are in sync.
  $this
    ->assertTrue($format_basic_html
    ->get('status'));
  $this
    ->assertTrue($editor_basic_html
    ->get('status'));
  $this
    ->assertIdentical($format_basic_html
    ->get('status'), $editor_basic_html
    ->get('status'));

  // Checks if the 'full_html' format and editor statuses are in sync.
  $this
    ->assertFalse($format_full_html
    ->get('status'));
  $this
    ->assertFalse($editor_full_html
    ->get('status'));
  $this
    ->assertIdentical($format_full_html
    ->get('status'), $editor_full_html
    ->get('status'));
}