5e7e5203cbbe46cb836bd60e7f4ea59fdeb182e8
[yaffs-website] / web / core / modules / editor / tests / src / Functional / Update / EditorUpdateTest.php
1 <?php
2
3 namespace Drupal\Tests\editor\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests Editor module database updates.
9  *
10  * @group editor
11  * @group legacy
12  */
13 class EditorUpdateTest extends UpdatePathTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public function setDatabaseDumpFiles() {
19     $this->databaseDumpFiles = [
20       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
21       // Simulate an un-synchronized environment.
22       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.editor-editor_update_8001.php',
23     ];
24   }
25
26   /**
27    * Tests editor_update_8001().
28    *
29    * @see editor_update_8001()
30    */
31   public function testEditorUpdate8001() {
32     /** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
33     $config_factory = $this->container->get('config.factory');
34
35     $format_basic_html = $config_factory->get('filter.format.basic_html');
36     $editor_basic_html = $config_factory->get('editor.editor.basic_html');
37     $format_full_html = $config_factory->get('filter.format.full_html');
38     $editor_full_html = $config_factory->get('editor.editor.full_html');
39
40     // Checks if the 'basic_html' format and editor statuses differ.
41     $this->assertTrue($format_basic_html->get('status'));
42     $this->assertFalse($editor_basic_html->get('status'));
43     $this->assertNotIdentical($format_basic_html->get('status'), $editor_basic_html->get('status'));
44
45     // Checks if the 'full_html' format and editor statuses differ.
46     $this->assertFalse($format_full_html->get('status'));
47     $this->assertTrue($editor_full_html->get('status'));
48     $this->assertNotIdentical($format_full_html->get('status'), $editor_full_html->get('status'));
49
50     // Run updates.
51     $this->runUpdates();
52
53     // Reload text formats and editors.
54     $format_basic_html = $config_factory->get('filter.format.basic_html');
55     $editor_basic_html = $config_factory->get('editor.editor.basic_html');
56     $format_full_html = $config_factory->get('filter.format.full_html');
57     $editor_full_html = $config_factory->get('editor.editor.full_html');
58
59     // Checks if the 'basic_html' format and editor statuses are in sync.
60     $this->assertTrue($format_basic_html->get('status'));
61     $this->assertTrue($editor_basic_html->get('status'));
62     $this->assertIdentical($format_basic_html->get('status'), $editor_basic_html->get('status'));
63
64     // Checks if the 'full_html' format and editor statuses are in sync.
65     $this->assertFalse($format_full_html->get('status'));
66     $this->assertFalse($editor_full_html->get('status'));
67     $this->assertIdentical($format_full_html->get('status'), $editor_full_html->get('status'));
68   }
69
70 }