Commit e825a16a authored by catch's avatar catch

Issue #2503379 by Mac_Weber, DuaelFr, lluvigne, naveenvalecha, jmolivas:...

Issue #2503379 by Mac_Weber, DuaelFr, lluvigne, naveenvalecha, jmolivas: Replace deprecated usage of entity_create('filter_format') with a direct call to FilterFormat::create()
parent 68b4dde2
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\block\Tests; namespace Drupal\block\Tests;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Provides setup and helper methods for block module tests. * Provides setup and helper methods for block module tests.
...@@ -42,7 +43,7 @@ protected function setUp() { ...@@ -42,7 +43,7 @@ protected function setUp() {
$this->config('system.site')->set('page.front', '/test-page')->save(); $this->config('system.site')->set('page.front', '/test-page')->save();
// Create Full HTML text format. // Create Full HTML text format.
$full_html_format = entity_create('filter_format', array( $full_html_format = FilterFormat::create(array(
'format' => 'full_html', 'format' => 'full_html',
'name' => 'Full HTML', 'name' => 'Full HTML',
)); ));
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
use Drupal\editor\Entity\Editor; use Drupal\editor\Entity\Editor;
use Drupal\filter\FilterFormatInterface; use Drupal\filter\FilterFormatInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests administration of CKEditor. * Tests administration of CKEditor.
...@@ -37,7 +38,7 @@ protected function setUp() { ...@@ -37,7 +38,7 @@ protected function setUp() {
parent::setUp(); parent::setUp();
// Create text format. // Create text format.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'weight' => 0, 'weight' => 0,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\editor\Entity\Editor; use Drupal\editor\Entity\Editor;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests loading of CKEditor. * Tests loading of CKEditor.
...@@ -42,7 +43,7 @@ protected function setUp() { ...@@ -42,7 +43,7 @@ protected function setUp() {
parent::setUp(); parent::setUp();
// Create text format, associate CKEditor. // Create text format, associate CKEditor.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'weight' => 0, 'weight' => 0,
...@@ -57,7 +58,7 @@ protected function setUp() { ...@@ -57,7 +58,7 @@ protected function setUp() {
// Create a second format without an associated editor so a drop down select // Create a second format without an associated editor so a drop down select
// list is created when selecting formats. // list is created when selecting formats.
$full_html_format = entity_create('filter_format', array( $full_html_format = FilterFormat::create(array(
'format' => 'full_html', 'format' => 'full_html',
'name' => 'Full HTML', 'name' => 'Full HTML',
'weight' => 1, 'weight' => 1,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\editor\Entity\Editor; use Drupal\editor\Entity\Editor;
use Drupal\simpletest\KernelTestBase; use Drupal\simpletest\KernelTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests different ways of enabling CKEditor plugins. * Tests different ways of enabling CKEditor plugins.
...@@ -38,7 +39,7 @@ protected function setUp() { ...@@ -38,7 +39,7 @@ protected function setUp() {
$this->installSchema('system', 'url_alias'); $this->installSchema('system', 'url_alias');
// Create text format, associate CKEditor. // Create text format, associate CKEditor.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'weight' => 0, 'weight' => 0,
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\simpletest\KernelTestBase; use Drupal\simpletest\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage; use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\editor\Entity\Editor; use Drupal\editor\Entity\Editor;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests for the 'CKEditor' text editor plugin. * Tests for the 'CKEditor' text editor plugin.
...@@ -46,7 +47,7 @@ protected function setUp() { ...@@ -46,7 +47,7 @@ protected function setUp() {
$this->installSchema('system', 'url_alias'); $this->installSchema('system', 'url_alias');
// Create text format, associate CKEditor. // Create text format, associate CKEditor.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'weight' => 0, 'weight' => 0,
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\shortcut\Entity\ShortcutSet; use Drupal\shortcut\Entity\ShortcutSet;
use Drupal\contact\Entity\ContactForm; use Drupal\contact\Entity\ContactForm;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Visit all lists. * Visit all lists.
...@@ -260,7 +261,7 @@ public function doContentTypeListTest() { ...@@ -260,7 +261,7 @@ public function doContentTypeListTest() {
public function doFormatsListTest() { public function doFormatsListTest() {
// Create a test format to decouple looking for translate operations // Create a test format to decouple looking for translate operations
// link so this does not test more than necessary. // link so this does not test more than necessary.
$filter_format = entity_create('filter_format', array( $filter_format = FilterFormat::create(array(
'format' => Unicode::strtolower($this->randomMachineName(16)), 'format' => Unicode::strtolower($this->randomMachineName(16)),
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
)); ));
......
...@@ -38,7 +38,7 @@ protected function setUp() { ...@@ -38,7 +38,7 @@ protected function setUp() {
parent::setUp(); parent::setUp();
// Add text format. // Add text format.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'weight' => 0, 'weight' => 0,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
use Drupal\system\Tests\Entity\EntityUnitTestBase; use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests tracking of file usage by the Text Editor module. * Tests tracking of file usage by the Text Editor module.
...@@ -35,7 +36,7 @@ protected function setUp() { ...@@ -35,7 +36,7 @@ protected function setUp() {
$this->installConfig(['node']); $this->installConfig(['node']);
// Add text formats. // Add text formats.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'weight' => 0, 'weight' => 0,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldStorageConfig;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests loading of text editors. * Tests loading of text editors.
...@@ -56,14 +57,14 @@ protected function setUp() { ...@@ -56,14 +57,14 @@ protected function setUp() {
\Drupal::service('plugin.manager.editor')->clearCachedDefinitions(); \Drupal::service('plugin.manager.editor')->clearCachedDefinitions();
// Add text formats. // Add text formats.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'weight' => 0, 'weight' => 0,
'filters' => array(), 'filters' => array(),
)); ));
$filtered_html_format->save(); $filtered_html_format->save();
$full_html_format = entity_create('filter_format', array( $full_html_format = FilterFormat::create(array(
'format' => 'full_html', 'format' => 'full_html',
'name' => 'Full HTML', 'name' => 'Full HTML',
'weight' => 1, 'weight' => 1,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\editor\Entity\Editor; use Drupal\editor\Entity\Editor;
use Drupal\simpletest\KernelTestBase; use Drupal\simpletest\KernelTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests detection of text editors and correct generation of attachments. * Tests detection of text editors and correct generation of attachments.
...@@ -38,14 +39,14 @@ protected function setUp() { ...@@ -38,14 +39,14 @@ protected function setUp() {
$this->installSchema('system', 'url_alias'); $this->installSchema('system', 'url_alias');
// Add text formats. // Add text formats.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'weight' => 0, 'weight' => 0,
'filters' => array(), 'filters' => array(),
)); ));
$filtered_html_format->save(); $filtered_html_format->save();
$full_html_format = entity_create('filter_format', array( $full_html_format = FilterFormat::create(array(
'format' => 'full_html', 'format' => 'full_html',
'name' => 'Full HTML', 'name' => 'Full HTML',
'weight' => 1, 'weight' => 1,
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Component\Serialization\Json; use Drupal\Component\Serialization\Json;
use Drupal\editor\Entity\Editor; use Drupal\editor\Entity\Editor;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests XSS protection for content creators when using text editors. * Tests XSS protection for content creators when using text editors.
...@@ -87,7 +88,7 @@ protected function setUp() { ...@@ -87,7 +88,7 @@ protected function setUp() {
// With text formats 2, 3 and 5, we also associate a text editor that does // With text formats 2, 3 and 5, we also associate a text editor that does
// not guarantee XSS safety. "restricted" means the text format has XSS // not guarantee XSS safety. "restricted" means the text format has XSS
// filters on output, "unrestricted" means the opposite. // filters on output, "unrestricted" means the opposite.
$format = entity_create('filter_format', array( $format = FilterFormat::create(array(
'format' => 'restricted_without_editor', 'format' => 'restricted_without_editor',
'name' => 'Restricted HTML, without text editor', 'name' => 'Restricted HTML, without text editor',
'weight' => 0, 'weight' => 0,
...@@ -102,7 +103,7 @@ protected function setUp() { ...@@ -102,7 +103,7 @@ protected function setUp() {
), ),
)); ));
$format->save(); $format->save();
$format = entity_create('filter_format', array( $format = FilterFormat::create(array(
'format' => 'restricted_with_editor', 'format' => 'restricted_with_editor',
'name' => 'Restricted HTML, with text editor', 'name' => 'Restricted HTML, with text editor',
'weight' => 1, 'weight' => 1,
...@@ -122,7 +123,7 @@ protected function setUp() { ...@@ -122,7 +123,7 @@ protected function setUp() {
'editor' => 'unicorn', 'editor' => 'unicorn',
]); ]);
$editor->save(); $editor->save();
$format = entity_create('filter_format', array( $format = FilterFormat::create(array(
'format' => 'restricted_plus_dangerous_tag_with_editor', 'format' => 'restricted_plus_dangerous_tag_with_editor',
'name' => 'Restricted HTML, dangerous tag allowed, with text editor', 'name' => 'Restricted HTML, dangerous tag allowed, with text editor',
'weight' => 1, 'weight' => 1,
...@@ -142,14 +143,14 @@ protected function setUp() { ...@@ -142,14 +143,14 @@ protected function setUp() {
'editor' => 'unicorn', 'editor' => 'unicorn',
]); ]);
$editor->save(); $editor->save();
$format = entity_create('filter_format', array( $format = FilterFormat::create(array(
'format' => 'unrestricted_without_editor', 'format' => 'unrestricted_without_editor',
'name' => 'Unrestricted HTML, without text editor', 'name' => 'Unrestricted HTML, without text editor',
'weight' => 0, 'weight' => 0,
'filters' => array(), 'filters' => array(),
)); ));
$format->save(); $format->save();
$format = entity_create('filter_format', array( $format = FilterFormat::create(array(
'format' => 'unrestricted_with_editor', 'format' => 'unrestricted_with_editor',
'name' => 'Unrestricted HTML, with text editor', 'name' => 'Unrestricted HTML, with text editor',
'weight' => 1, 'weight' => 1,
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Component\Serialization\Json; use Drupal\Component\Serialization\Json;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber; use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests Quick Edit module integration endpoints. * Tests Quick Edit module integration endpoints.
...@@ -36,7 +37,7 @@ protected function setUp() { ...@@ -36,7 +37,7 @@ protected function setUp() {
parent::setUp(); parent::setUp();
// Create a text format. // Create a text format.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'weight' => 0, 'weight' => 0,
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\HttpKernelInterface;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests Edit module integration (Editor module's inline editing support). * Tests Edit module integration (Editor module's inline editing support).
...@@ -87,7 +88,7 @@ protected function setUp() { ...@@ -87,7 +88,7 @@ protected function setUp() {
); );
// Create text format. // Create text format.
$full_html_format = entity_create('filter_format', array( $full_html_format = FilterFormat::create(array(
'format' => 'full_html', 'format' => 'full_html',
'name' => 'Full HTML', 'name' => 'Full HTML',
'weight' => 1, 'weight' => 1,
...@@ -103,7 +104,7 @@ protected function setUp() { ...@@ -103,7 +104,7 @@ protected function setUp() {
$editor->save(); $editor->save();
// Also create a text format without an associated text editor. // Also create a text format without an associated text editor.
entity_create('filter_format', array( FilterFormat::create(array(
'format' => 'no_editor', 'format' => 'no_editor',
'name' => 'No Text Editor', 'name' => 'No Text Editor',
'weight' => 2, 'weight' => 2,
......
...@@ -103,7 +103,7 @@ protected function setUp() { ...@@ -103,7 +103,7 @@ protected function setUp() {
)) ))
->save(); ->save();
entity_create('filter_format', array( FilterFormat::create(array(
'format' => 'full_html', 'format' => 'full_html',
'name' => 'Full HTML', 'name' => 'Full HTML',
))->save(); ))->save();
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
use Drupal\Core\Session\AnonymousUserSession; use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Core\TypedData\OptionsProviderInterface; use Drupal\Core\TypedData\OptionsProviderInterface;
use Drupal\Core\TypedData\DataDefinition; use Drupal\Core\TypedData\DataDefinition;
use Drupal\filter\Plugin\DataType\FilterFormat; use Drupal\filter\Entity\FilterFormat;
use Drupal\filter\Plugin\DataType\FilterFormat as FilterFormatDataType;
use Drupal\filter\Plugin\FilterInterface; use Drupal\filter\Plugin\FilterInterface;
use Drupal\system\Tests\Entity\EntityUnitTestBase; use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\ConstraintViolationListInterface;
...@@ -36,7 +37,7 @@ protected function setUp() { ...@@ -36,7 +37,7 @@ protected function setUp() {
*/ */
function testCheckMarkupFilterOrder() { function testCheckMarkupFilterOrder() {
// Create crazy HTML format. // Create crazy HTML format.
$crazy_format = entity_create('filter_format', array( $crazy_format = FilterFormat::create(array(
'format' => 'crazy', 'format' => 'crazy',
'name' => 'Crazy', 'name' => 'Crazy',
'weight' => 1, 'weight' => 1,
...@@ -138,7 +139,7 @@ function testFilterFormatAPI() { ...@@ -138,7 +139,7 @@ function testFilterFormatAPI() {
); );
// Test on stupid_filtered_html, where nothing is allowed. // Test on stupid_filtered_html, where nothing is allowed.
$stupid_filtered_html_format = entity_create('filter_format', array( $stupid_filtered_html_format = FilterFormat::create(array(
'format' => 'stupid_filtered_html', 'format' => 'stupid_filtered_html',
'name' => 'Stupid Filtered HTML', 'name' => 'Stupid Filtered HTML',
'filters' => array( 'filters' => array(
...@@ -164,7 +165,7 @@ function testFilterFormatAPI() { ...@@ -164,7 +165,7 @@ function testFilterFormatAPI() {
// Test on very_restricted_html, where there's two different filters of the // Test on very_restricted_html, where there's two different filters of the
// FilterInterface::TYPE_HTML_RESTRICTOR type, each restricting in different ways. // FilterInterface::TYPE_HTML_RESTRICTOR type, each restricting in different ways.
$very_restricted_html_format = entity_create('filter_format', array( $very_restricted_html_format = FilterFormat::create(array(
'format' => 'very_restricted_html', 'format' => 'very_restricted_html',
'name' => 'Very Restricted HTML', 'name' => 'Very Restricted HTML',
'filters' => array( 'filters' => array(
...@@ -254,7 +255,7 @@ function testFilterFormatAPI() { ...@@ -254,7 +255,7 @@ function testFilterFormatAPI() {
* This test focuses solely on those advanced features. * This test focuses solely on those advanced features.
*/ */
function testProcessedTextElement() { function testProcessedTextElement() {
entity_create('filter_format', array( FilterFormat::create(array(
'format' => 'element_test', 'format' => 'element_test',
'name' => 'processed_text element test format', 'name' => 'processed_text element test format',
'filters' => array( 'filters' => array(
...@@ -401,7 +402,7 @@ function testTypedDataAPI() { ...@@ -401,7 +402,7 @@ function testTypedDataAPI() {
*/ */
public function testFilterFormatPreSave() { public function testFilterFormatPreSave() {
/** @var \Drupal\filter\FilterFormatInterface $crazy_format */ /** @var \Drupal\filter\FilterFormatInterface $crazy_format */
$crazy_format = entity_create('filter_format', array( $crazy_format = FilterFormat::create(array(
'format' => 'crazy', 'format' => 'crazy',
'name' => 'Crazy', 'name' => 'Crazy',
'weight' => 1, 'weight' => 1,
...@@ -451,7 +452,7 @@ public function testFilterFormatPreSave() { ...@@ -451,7 +452,7 @@ public function testFilterFormatPreSave() {
public function assertFilterFormatViolation(ConstraintViolationListInterface $violations, $invalid_value) { public function assertFilterFormatViolation(ConstraintViolationListInterface $violations, $invalid_value) {
$filter_format_violation_found = FALSE; $filter_format_violation_found = FALSE;
foreach ($violations as $violation) { foreach ($violations as $violation) {
if ($violation->getRoot() instanceof FilterFormat && $violation->getInvalidValue() === $invalid_value) { if ($violation->getRoot() instanceof FilterFormatDataType && $violation->getInvalidValue() === $invalid_value) {
$filter_format_violation_found = TRUE; $filter_format_violation_found = TRUE;
break; break;
} }
......
...@@ -50,7 +50,7 @@ protected function setUp() { ...@@ -50,7 +50,7 @@ protected function setUp() {
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
// Set up the filter formats used by this test. // Set up the filter formats used by this test.
$basic_html_format = entity_create('filter_format', array( $basic_html_format = FilterFormat::create(array(
'format' => 'basic_html', 'format' => 'basic_html',
'name' => 'Basic HTML', 'name' => 'Basic HTML',
'filters' => array( 'filters' => array(
...@@ -63,7 +63,7 @@ protected function setUp() { ...@@ -63,7 +63,7 @@ protected function setUp() {
), ),
)); ));
$basic_html_format->save(); $basic_html_format->save();
$restricted_html_format = entity_create('filter_format', array( $restricted_html_format = FilterFormat::create(array(
'format' => 'restricted_html', 'format' => 'restricted_html',
'name' => 'Restricted HTML', 'name' => 'Restricted HTML',
'filters' => array( 'filters' => array(
...@@ -89,7 +89,7 @@ protected function setUp() { ...@@ -89,7 +89,7 @@ protected function setUp() {
), ),
)); ));
$restricted_html_format->save(); $restricted_html_format->save();
$full_html_format = entity_create('filter_format', array( $full_html_format = FilterFormat::create(array(
'format' => 'full_html', 'format' => 'full_html',
'name' => 'Full HTML', 'name' => 'Full HTML',
'weight' => 1, 'weight' => 1,
......
...@@ -29,14 +29,15 @@ class FilterCrudTest extends KernelTestBase { ...@@ -29,14 +29,15 @@ class FilterCrudTest extends KernelTestBase {
*/ */
function testTextFormatCrud() { function testTextFormatCrud() {
// Add a text format with minimum data only. // Add a text format with minimum data only.
$format = entity_create('filter_format'); $format = FilterFormat::create(array(
$format->set('format', 'empty_format'); 'format' => 'empty_format',
$format->set('name', 'Empty format'); 'name' => 'Empty format',
));
$format->save(); $format->save();
$this->verifyTextFormat($format); $this->verifyTextFormat($format);
// Add another text format specifying all possible properties. // Add another text format specifying all possible properties.
$format = entity_create('filter_format', array( $format = FilterFormat::create(array(
'format' => 'custom_format', 'format' => 'custom_format',
'name' => 'Custom format', 'name' => 'Custom format',
)); ));
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\comment\Tests\CommentTestTrait; use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Core\StreamWrapper\PublicStream; use Drupal\Core\StreamWrapper\PublicStream;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests restriction of IMG tags in HTML input. * Tests restriction of IMG tags in HTML input.
...@@ -38,7 +39,7 @@ protected function setUp() { ...@@ -38,7 +39,7 @@ protected function setUp() {
parent::setUp(); parent::setUp();
// Setup Filtered HTML text format. // Setup Filtered HTML text format.
$filtered_html_format = entity_create('filter_format', array( $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'name' => 'Filtered HTML', 'name' => 'Filtered HTML',
'filters' => array( 'filters' => array(
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\filter\Tests; namespace Drupal\filter\Tests;
use Drupal\simpletest\KernelTestBase; use Drupal\simpletest\KernelTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests filter settings. * Tests filter settings.
...@@ -30,7 +31,7 @@ function testFilterDefaults() { ...@@ -30,7 +31,7 @@ function testFilterDefaults() {
$filter_info = $this->container->get('plugin.manager.filter')->getDefinitions(); $filter_info = $this->container->get('plugin.manager.filter')->getDefinitions();
// Create text format using filter default settings. // Create text format using filter default settings.
$filter_defaults_format = entity_create('filter_format', array( $filter_defaults_format = FilterFormat::create(array(
'format' => 'filter_defaults', 'format' => 'filter_defaults',
'name' => 'Filter defaults', 'name' => 'Filter defaults',
)); ));
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\quickedit\EditorSelector; use Drupal\quickedit\EditorSelector;
use Drupal\quickedit\MetadataGenerator; use Drupal\quickedit\MetadataGenerator;
use Drupal\quickedit_test\MockEditEntityFieldAccessCheck; use Drupal\quickedit_test\MockEditEntityFieldAccessCheck;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests in-place field editing metadata. * Tests in-place field editing metadata.
...@@ -149,7 +150,7 @@ public function testEditorWithCustomMetadata() { ...@@ -149,7 +150,7 @@ public function testEditorWithCustomMetadata() {
); );
// Create a text format. // Create a text format.
$full_html_format = entity_create('filter_format', array( $full_html_format = FilterFormat::create(array(
'format' => 'full_html', 'format' => 'full_html',
'name' => 'Full HTML', 'name' => 'Full HTML',
'weight' => 1, 'weight' => 1,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
use Drupal\node\Entity\Node; use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType; use Drupal\node\Entity\NodeType;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\filter\Entity\FilterFormat;
/** /**
* Tests loading of in-place editing functionality and lazy loading of its