From 0b2bf266297002ff5a0463f5152f6b9b921b19f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kurucz=20Istv=C3=A1n?= <never@nevergone.hu>
Date: Thu, 12 May 2022 12:03:55 +0200
Subject: [PATCH] Complete Filter format migration test.

---
 tests/src/Kernel/MigrateFilterFormatTest.php | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/tests/src/Kernel/MigrateFilterFormatTest.php b/tests/src/Kernel/MigrateFilterFormatTest.php
index 947fca9..2dc3a76 100644
--- a/tests/src/Kernel/MigrateFilterFormatTest.php
+++ b/tests/src/Kernel/MigrateFilterFormatTest.php
@@ -74,4 +74,33 @@ class MigrateFilterFormatTest extends MigrateDrupal5TestBase {
     $filter_config = FilterFormat::load('filtered_html')->filters('filter_url')->getConfiguration();
     $this->assertSame($filter_plugin->getPluginDefinition()['settings']['filter_url_length'], $filter_config['settings']['filter_url_length']);
   }
+
+  /**
+   * Test 'Full HTML' filter format.
+   */
+  public function testFullHtmlFilterFormat() {
+    $this->assertEntity('full_html', 'Full HTML', ['filter_autop' => 1, 'filter_url' => 0]);
+  }
+
+  /**
+   * Test 'PHP code' filter format.
+   */
+  public function testPhpCodeFilterFormat() {
+    $this->assertEntity('php_code', 'PHP code', ['filter_html_escape' => 10]);
+  }
+
+  /**
+   * Test 'Customized format' filter format.
+   */
+  public function testCustomizedFormatFilterFormat() {
+    $this->assertEntity('customized_format', 'Customized format', ['filter_html' => 5, 'filter_autop' => 2, 'filter_html_escape' => -10, 'filter_url' => 0]);
+    // filter_html
+    $filter_config = FilterFormat::load('customized_format')->filters('filter_html')->getConfiguration();
+    $this->assertSame('<a href hreflang> <em> <strong> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <test1> <test2>', $filter_config['settings']['allowed_html']);
+    $this->assertEquals(TRUE, $filter_config['settings']['filter_html_help']);
+    $this->assertEquals(TRUE, $filter_config['settings']['filter_html_nofollow']);
+    // filter_url
+    $filter_config = FilterFormat::load('customized_format')->filters('filter_url')->getConfiguration();
+    $this->assertSame(123, $filter_config['settings']['filter_url_length']);
+  }
 }
-- 
GitLab