Security update for Core, with self-updated composer
[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  */
12 class EditorUpdateTest extends UpdatePathTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function setDatabaseDumpFiles() {
18     $this->databaseDumpFiles = [
19       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
20       // Simulate an un-synchronized environment.
21       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.editor-editor_update_8001.php',
22     ];
23   }
24
25   /**
26    * Tests editor_update_8001().
27    *
28    * @see editor_update_8001()
29    */
30   public function testEditorUpdate8001() {
31     /** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
32     $config_factory = $this->container->get('config.factory');
33
34     $format_basic_html = $config_factory->get('filter.format.basic_html');
35     $editor_basic_html = $config_factory->get('editor.editor.basic_html');
36     $format_full_html = $config_factory->get('filter.format.full_html');
37     $editor_full_html = $config_factory->get('editor.editor.full_html');
38
39     // Checks if the 'basic_html' format and editor statuses differ.
40     $this->assertTrue($format_basic_html->get('status'));
41     $this->assertFalse($editor_basic_html->get('status'));
42     $this->assertNotIdentical($format_basic_html->get('status'), $editor_basic_html->get('status'));
43
44     // Checks if the 'full_html' format and editor statuses differ.
45     $this->assertFalse($format_full_html->get('status'));
46     $this->assertTrue($editor_full_html->get('status'));
47     $this->assertNotIdentical($format_full_html->get('status'), $editor_full_html->get('status'));
48
49     // Run updates.
50     $this->runUpdates();
51
52     // Reload text formats and editors.
53     $format_basic_html = $config_factory->get('filter.format.basic_html');
54     $editor_basic_html = $config_factory->get('editor.editor.basic_html');
55     $format_full_html = $config_factory->get('filter.format.full_html');
56     $editor_full_html = $config_factory->get('editor.editor.full_html');
57
58     // Checks if the 'basic_html' format and editor statuses are in sync.
59     $this->assertTrue($format_basic_html->get('status'));
60     $this->assertTrue($editor_basic_html->get('status'));
61     $this->assertIdentical($format_basic_html->get('status'), $editor_basic_html->get('status'));
62
63     // Checks if the 'full_html' format and editor statuses are in sync.
64     $this->assertFalse($format_full_html->get('status'));
65     $this->assertFalse($editor_full_html->get('status'));
66     $this->assertIdentical($format_full_html->get('status'), $editor_full_html->get('status'));
67   }
68
69 }