Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / system / tests / src / Functional / Update / FilterHtmlUpdateTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Functional\Update;
4
5 use Drupal\filter\Entity\FilterFormat;
6 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
7
8 /**
9  * Tests that the allowed html configurations are updated with attributes.
10  *
11  * @group Entity
12  * @group legacy
13  */
14 class FilterHtmlUpdateTest extends UpdatePathTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function setDatabaseDumpFiles() {
20     $this->databaseDumpFiles = [
21       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
22     ];
23   }
24
25   /**
26    * Tests system_update_8009().
27    */
28   public function testAllowedHtmlUpdate() {
29     // Make sure we have the expected values before the update.
30     $filters_before = [
31       'basic_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6> <p> <br> <span> <img>',
32       'restricted_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6>',
33     ];
34     foreach ($filters_before as $name => $before) {
35       $config = FilterFormat::load($name)->toArray();
36       $this->assertIdentical($before, $config['filters']['filter_html']['settings']['allowed_html']);
37     }
38
39     $this->runUpdates();
40
41     // Make sure we have the expected values after the update.
42     $filters_after = [
43       'basic_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h4 id> <h5 id> <h6 id> <p> <br> <span> <img src alt height width data-align data-caption>',
44       'restricted_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h4 id> <h5 id> <h6 id>',
45     ];
46     foreach ($filters_after as $name => $after) {
47       $config = FilterFormat::load($name)->toArray();
48       $this->assertIdentical($after, $config['filters']['filter_html']['settings']['allowed_html']);
49     }
50   }
51
52 }