MigrateFilterFormatTest.php in Drupal 9
File
core/modules/filter/tests/src/Kernel/Migrate/d6/MigrateFilterFormatTest.php
View source
<?php
namespace Drupal\Tests\filter\Kernel\Migrate\d6;
use Drupal\filter\Entity\FilterFormat;
use Drupal\filter\FilterFormatInterface;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateFilterFormatTest extends MigrateDrupal6TestBase {
protected function setUp() : void {
parent::setUp();
$this
->executeMigration('d6_filter_format');
}
public function testFilterFormat() {
$filter_format = FilterFormat::load('filtered_html');
$filters = $filter_format
->get('filters');
$this
->assertTrue($filters['filter_autop']['status']);
$this
->assertTrue($filters['filter_url']['status']);
$this
->assertTrue($filters['filter_htmlcorrector']['status']);
$this
->assertTrue($filters['filter_html']['status']);
$this
->assertFalse(isset($filters['filter_html_escape']));
$this
->assertFalse(isset($filters['filter_caption']));
$this
->assertFalse(isset($filters['filter_html_image_secure']));
$this
->assertSame('<a href hreflang> <em> <strong> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>', $filters['filter_html']['settings']['allowed_html']);
$this
->assertTrue($filters['filter_html']['settings']['filter_html_help']);
$this
->assertFalse($filters['filter_html']['settings']['filter_html_nofollow']);
$this
->assertSame(72, $filters['filter_url']['settings']['filter_url_length']);
$filter_format = FilterFormat::load('php_code');
$this
->assertInstanceOf(FilterFormatInterface::class, $filter_format);
$filters = $filter_format
->get('filters');
$this
->assertArrayHasKey('filter_null', $filters);
$this
->assertArrayNotHasKey('php_code', $filters);
}
}