summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-02-17 00:42:55 (GMT)
committerNathaniel Catchpole2016-02-17 00:42:55 (GMT)
commite825a16a3cb593f294170d6e04c86015f94933d6 (patch)
tree3bcba41bca192ab13bca7abb5e100089cf19ebe5
parent68b4dde2e8f54b6f30957e88ccaf2816db9ff27b (diff)
Issue #2503379 by Mac_Weber, DuaelFr, lluvigne, naveenvalecha, jmolivas: Replace deprecated usage of entity_create('filter_format') with a direct call to FilterFormat::create()
-rw-r--r--core/modules/block/src/Tests/BlockTestBase.php3
-rw-r--r--core/modules/ckeditor/src/Tests/CKEditorAdminTest.php3
-rw-r--r--core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php5
-rw-r--r--core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php3
-rw-r--r--core/modules/ckeditor/src/Tests/CKEditorTest.php3
-rw-r--r--core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php3
-rw-r--r--core/modules/editor/src/Tests/EditorAdminTest.php2
-rw-r--r--core/modules/editor/src/Tests/EditorFileUsageTest.php3
-rw-r--r--core/modules/editor/src/Tests/EditorLoadingTest.php5
-rw-r--r--core/modules/editor/src/Tests/EditorManagerTest.php5
-rw-r--r--core/modules/editor/src/Tests/EditorSecurityTest.php11
-rw-r--r--core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php3
-rw-r--r--core/modules/editor/src/Tests/QuickEditIntegrationTest.php5
-rw-r--r--core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php2
-rw-r--r--core/modules/filter/src/Tests/FilterAPITest.php15
-rw-r--r--core/modules/filter/src/Tests/FilterAdminTest.php6
-rw-r--r--core/modules/filter/src/Tests/FilterCrudTest.php9
-rw-r--r--core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php3
-rw-r--r--core/modules/filter/src/Tests/FilterSettingsTest.php3
-rw-r--r--core/modules/quickedit/src/Tests/MetadataGeneratorTest.php3
-rw-r--r--core/modules/quickedit/src/Tests/QuickEditLoadingTest.php3
-rw-r--r--core/modules/search/src/Tests/SearchCommentTest.php5
-rw-r--r--core/modules/search/src/Tests/SearchRankingTest.php3
-rw-r--r--core/modules/system/src/Tests/Form/FormTest.php3
-rw-r--r--core/modules/text/src/Tests/Formatter/TextFormatterTest.php2
-rw-r--r--core/modules/text/src/Tests/TextSummaryTest.php5
-rw-r--r--core/modules/text/src/Tests/TextWithSummaryItemTest.php3
27 files changed, 71 insertions, 48 deletions
diff --git a/core/modules/block/src/Tests/BlockTestBase.php b/core/modules/block/src/Tests/BlockTestBase.php
index 5e59114..e87b633 100644
--- a/core/modules/block/src/Tests/BlockTestBase.php
+++ b/core/modules/block/src/Tests/BlockTestBase.php
@@ -8,6 +8,7 @@
namespace Drupal\block\Tests;
use Drupal\simpletest\WebTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Provides setup and helper methods for block module tests.
@@ -42,7 +43,7 @@ abstract class BlockTestBase extends WebTestBase {
$this->config('system.site')->set('page.front', '/test-page')->save();
// Create Full HTML text format.
- $full_html_format = entity_create('filter_format', array(
+ $full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
));
diff --git a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php
index da06bd4..75df6e0 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php
@@ -11,6 +11,7 @@ use Drupal\Component\Serialization\Json;
use Drupal\editor\Entity\Editor;
use Drupal\filter\FilterFormatInterface;
use Drupal\simpletest\WebTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests administration of CKEditor.
@@ -37,7 +38,7 @@ class CKEditorAdminTest extends WebTestBase {
parent::setUp();
// Create text format.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
diff --git a/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php b/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php
index 8ee31ac..feba8ec 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php
@@ -9,6 +9,7 @@ namespace Drupal\ckeditor\Tests;
use Drupal\editor\Entity\Editor;
use Drupal\simpletest\WebTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests loading of CKEditor.
@@ -42,7 +43,7 @@ class CKEditorLoadingTest extends WebTestBase {
parent::setUp();
// Create text format, associate CKEditor.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
@@ -57,7 +58,7 @@ class CKEditorLoadingTest extends WebTestBase {
// Create a second format without an associated editor so a drop down select
// list is created when selecting formats.
- $full_html_format = entity_create('filter_format', array(
+ $full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
diff --git a/core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php b/core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php
index 86aaf7e..b664f81 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php
@@ -9,6 +9,7 @@ namespace Drupal\ckeditor\Tests;
use Drupal\editor\Entity\Editor;
use Drupal\simpletest\KernelTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests different ways of enabling CKEditor plugins.
@@ -38,7 +39,7 @@ class CKEditorPluginManagerTest extends KernelTestBase {
$this->installSchema('system', 'url_alias');
// Create text format, associate CKEditor.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php
index 3948ac2..929acca 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php
@@ -10,6 +10,7 @@ namespace Drupal\ckeditor\Tests;
use Drupal\simpletest\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\editor\Entity\Editor;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests for the 'CKEditor' text editor plugin.
@@ -46,7 +47,7 @@ class CKEditorTest extends KernelTestBase {
$this->installSchema('system', 'url_alias');
// Create text format, associate CKEditor.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
index 88c6c8f..352ce81 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
@@ -14,6 +14,7 @@ use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\WebTestBase;
use Drupal\shortcut\Entity\ShortcutSet;
use Drupal\contact\Entity\ContactForm;
+use Drupal\filter\Entity\FilterFormat;
/**
* Visit all lists.
@@ -260,7 +261,7 @@ class ConfigTranslationListUiTest extends WebTestBase {
public function doFormatsListTest() {
// Create a test format to decouple looking for translate operations
// 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)),
'name' => $this->randomMachineName(),
));
diff --git a/core/modules/editor/src/Tests/EditorAdminTest.php b/core/modules/editor/src/Tests/EditorAdminTest.php
index bc25912..8172f30 100644
--- a/core/modules/editor/src/Tests/EditorAdminTest.php
+++ b/core/modules/editor/src/Tests/EditorAdminTest.php
@@ -38,7 +38,7 @@ class EditorAdminTest extends WebTestBase {
parent::setUp();
// Add text format.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
diff --git a/core/modules/editor/src/Tests/EditorFileUsageTest.php b/core/modules/editor/src/Tests/EditorFileUsageTest.php
index b4c892a..e49ddb1 100644
--- a/core/modules/editor/src/Tests/EditorFileUsageTest.php
+++ b/core/modules/editor/src/Tests/EditorFileUsageTest.php
@@ -12,6 +12,7 @@ use Drupal\node\Entity\NodeType;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests tracking of file usage by the Text Editor module.
@@ -35,7 +36,7 @@ class EditorFileUsageTest extends EntityUnitTestBase {
$this->installConfig(['node']);
// Add text formats.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
diff --git a/core/modules/editor/src/Tests/EditorLoadingTest.php b/core/modules/editor/src/Tests/EditorLoadingTest.php
index eb4e08a..1511711 100644
--- a/core/modules/editor/src/Tests/EditorLoadingTest.php
+++ b/core/modules/editor/src/Tests/EditorLoadingTest.php
@@ -12,6 +12,7 @@ use Drupal\editor\Entity\Editor;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\simpletest\WebTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests loading of text editors.
@@ -56,14 +57,14 @@ class EditorLoadingTest extends WebTestBase {
\Drupal::service('plugin.manager.editor')->clearCachedDefinitions();
// Add text formats.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
'filters' => array(),
));
$filtered_html_format->save();
- $full_html_format = entity_create('filter_format', array(
+ $full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
diff --git a/core/modules/editor/src/Tests/EditorManagerTest.php b/core/modules/editor/src/Tests/EditorManagerTest.php
index 996d928..2dd0cf5 100644
--- a/core/modules/editor/src/Tests/EditorManagerTest.php
+++ b/core/modules/editor/src/Tests/EditorManagerTest.php
@@ -9,6 +9,7 @@ namespace Drupal\editor\Tests;
use Drupal\editor\Entity\Editor;
use Drupal\simpletest\KernelTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests detection of text editors and correct generation of attachments.
@@ -38,14 +39,14 @@ class EditorManagerTest extends KernelTestBase {
$this->installSchema('system', 'url_alias');
// Add text formats.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
'filters' => array(),
));
$filtered_html_format->save();
- $full_html_format = entity_create('filter_format', array(
+ $full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
diff --git a/core/modules/editor/src/Tests/EditorSecurityTest.php b/core/modules/editor/src/Tests/EditorSecurityTest.php
index 5800a16..16f2bb6 100644
--- a/core/modules/editor/src/Tests/EditorSecurityTest.php
+++ b/core/modules/editor/src/Tests/EditorSecurityTest.php
@@ -10,6 +10,7 @@ namespace Drupal\editor\Tests;
use Drupal\Component\Serialization\Json;
use Drupal\editor\Entity\Editor;
use Drupal\simpletest\WebTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests XSS protection for content creators when using text editors.
@@ -87,7 +88,7 @@ class EditorSecurityTest extends WebTestBase {
// 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
// filters on output, "unrestricted" means the opposite.
- $format = entity_create('filter_format', array(
+ $format = FilterFormat::create(array(
'format' => 'restricted_without_editor',
'name' => 'Restricted HTML, without text editor',
'weight' => 0,
@@ -102,7 +103,7 @@ class EditorSecurityTest extends WebTestBase {
),
));
$format->save();
- $format = entity_create('filter_format', array(
+ $format = FilterFormat::create(array(
'format' => 'restricted_with_editor',
'name' => 'Restricted HTML, with text editor',
'weight' => 1,
@@ -122,7 +123,7 @@ class EditorSecurityTest extends WebTestBase {
'editor' => 'unicorn',
]);
$editor->save();
- $format = entity_create('filter_format', array(
+ $format = FilterFormat::create(array(
'format' => 'restricted_plus_dangerous_tag_with_editor',
'name' => 'Restricted HTML, dangerous tag allowed, with text editor',
'weight' => 1,
@@ -142,14 +143,14 @@ class EditorSecurityTest extends WebTestBase {
'editor' => 'unicorn',
]);
$editor->save();
- $format = entity_create('filter_format', array(
+ $format = FilterFormat::create(array(
'format' => 'unrestricted_without_editor',
'name' => 'Unrestricted HTML, without text editor',
'weight' => 0,
'filters' => array(),
));
$format->save();
- $format = entity_create('filter_format', array(
+ $format = FilterFormat::create(array(
'format' => 'unrestricted_with_editor',
'name' => 'Unrestricted HTML, with text editor',
'weight' => 1,
diff --git a/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php b/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php
index 8f4ec18..af5623f 100644
--- a/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php
+++ b/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php
@@ -10,6 +10,7 @@ namespace Drupal\editor\Tests;
use Drupal\Component\Serialization\Json;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\simpletest\WebTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests Quick Edit module integration endpoints.
@@ -36,7 +37,7 @@ class QuickEditIntegrationLoadingTest extends WebTestBase {
parent::setUp();
// Create a text format.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
diff --git a/core/modules/editor/src/Tests/QuickEditIntegrationTest.php b/core/modules/editor/src/Tests/QuickEditIntegrationTest.php
index 820cab6..db8c3eb 100644
--- a/core/modules/editor/src/Tests/QuickEditIntegrationTest.php
+++ b/core/modules/editor/src/Tests/QuickEditIntegrationTest.php
@@ -18,6 +18,7 @@ use Drupal\editor\EditorController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests Edit module integration (Editor module's inline editing support).
@@ -87,7 +88,7 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
);
// Create text format.
- $full_html_format = entity_create('filter_format', array(
+ $full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
@@ -103,7 +104,7 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
$editor->save();
// Also create a text format without an associated text editor.
- entity_create('filter_format', array(
+ FilterFormat::create(array(
'format' => 'no_editor',
'name' => 'No Text Editor',
'weight' => 2,
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
index 6d0d0a8..5379750 100644
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
@@ -103,7 +103,7 @@ class EntityReferenceFormatterTest extends EntityUnitTestBase {
))
->save();
- entity_create('filter_format', array(
+ FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
))->save();
diff --git a/core/modules/filter/src/Tests/FilterAPITest.php b/core/modules/filter/src/Tests/FilterAPITest.php
index 5fd9999..a6a3d56 100644
--- a/core/modules/filter/src/Tests/FilterAPITest.php
+++ b/core/modules/filter/src/Tests/FilterAPITest.php
@@ -11,7 +11,8 @@ use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Core\TypedData\OptionsProviderInterface;
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\system\Tests\Entity\EntityUnitTestBase;
use Symfony\Component\Validator\ConstraintViolationListInterface;
@@ -36,7 +37,7 @@ class FilterAPITest extends EntityUnitTestBase {
*/
function testCheckMarkupFilterOrder() {
// Create crazy HTML format.
- $crazy_format = entity_create('filter_format', array(
+ $crazy_format = FilterFormat::create(array(
'format' => 'crazy',
'name' => 'Crazy',
'weight' => 1,
@@ -138,7 +139,7 @@ class FilterAPITest extends EntityUnitTestBase {
);
// 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',
'name' => 'Stupid Filtered HTML',
'filters' => array(
@@ -164,7 +165,7 @@ class FilterAPITest extends EntityUnitTestBase {
// Test on very_restricted_html, where there's two different filters of the
// 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',
'name' => 'Very Restricted HTML',
'filters' => array(
@@ -254,7 +255,7 @@ class FilterAPITest extends EntityUnitTestBase {
* This test focuses solely on those advanced features.
*/
function testProcessedTextElement() {
- entity_create('filter_format', array(
+ FilterFormat::create(array(
'format' => 'element_test',
'name' => 'processed_text element test format',
'filters' => array(
@@ -401,7 +402,7 @@ class FilterAPITest extends EntityUnitTestBase {
*/
public function testFilterFormatPreSave() {
/** @var \Drupal\filter\FilterFormatInterface $crazy_format */
- $crazy_format = entity_create('filter_format', array(
+ $crazy_format = FilterFormat::create(array(
'format' => 'crazy',
'name' => 'Crazy',
'weight' => 1,
@@ -451,7 +452,7 @@ class FilterAPITest extends EntityUnitTestBase {
public function assertFilterFormatViolation(ConstraintViolationListInterface $violations, $invalid_value) {
$filter_format_violation_found = FALSE;
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;
break;
}
diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php
index 0c61a9e..78dbfcb 100644
--- a/core/modules/filter/src/Tests/FilterAdminTest.php
+++ b/core/modules/filter/src/Tests/FilterAdminTest.php
@@ -50,7 +50,7 @@ class FilterAdminTest extends WebTestBase {
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
// 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',
'name' => 'Basic HTML',
'filters' => array(
@@ -63,7 +63,7 @@ class FilterAdminTest extends WebTestBase {
),
));
$basic_html_format->save();
- $restricted_html_format = entity_create('filter_format', array(
+ $restricted_html_format = FilterFormat::create(array(
'format' => 'restricted_html',
'name' => 'Restricted HTML',
'filters' => array(
@@ -89,7 +89,7 @@ class FilterAdminTest extends WebTestBase {
),
));
$restricted_html_format->save();
- $full_html_format = entity_create('filter_format', array(
+ $full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
diff --git a/core/modules/filter/src/Tests/FilterCrudTest.php b/core/modules/filter/src/Tests/FilterCrudTest.php
index 00a25fc..db0516b 100644
--- a/core/modules/filter/src/Tests/FilterCrudTest.php
+++ b/core/modules/filter/src/Tests/FilterCrudTest.php
@@ -29,14 +29,15 @@ class FilterCrudTest extends KernelTestBase {
*/
function testTextFormatCrud() {
// Add a text format with minimum data only.
- $format = entity_create('filter_format');
- $format->set('format', 'empty_format');
- $format->set('name', 'Empty format');
+ $format = FilterFormat::create(array(
+ 'format' => 'empty_format',
+ 'name' => 'Empty format',
+ ));
$format->save();
$this->verifyTextFormat($format);
// Add another text format specifying all possible properties.
- $format = entity_create('filter_format', array(
+ $format = FilterFormat::create(array(
'format' => 'custom_format',
'name' => 'Custom format',
));
diff --git a/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php
index 9d96c5f..aaa8c8b 100644
--- a/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php
+++ b/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php
@@ -10,6 +10,7 @@ namespace Drupal\filter\Tests;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Core\StreamWrapper\PublicStream;
use Drupal\simpletest\WebTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests restriction of IMG tags in HTML input.
@@ -38,7 +39,7 @@ class FilterHtmlImageSecureTest extends WebTestBase {
parent::setUp();
// Setup Filtered HTML text format.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'filters' => array(
diff --git a/core/modules/filter/src/Tests/FilterSettingsTest.php b/core/modules/filter/src/Tests/FilterSettingsTest.php
index 9b95336..fdd3270 100644
--- a/core/modules/filter/src/Tests/FilterSettingsTest.php
+++ b/core/modules/filter/src/Tests/FilterSettingsTest.php
@@ -8,6 +8,7 @@
namespace Drupal\filter\Tests;
use Drupal\simpletest\KernelTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests filter settings.
@@ -30,7 +31,7 @@ class FilterSettingsTest extends KernelTestBase {
$filter_info = $this->container->get('plugin.manager.filter')->getDefinitions();
// Create text format using filter default settings.
- $filter_defaults_format = entity_create('filter_format', array(
+ $filter_defaults_format = FilterFormat::create(array(
'format' => 'filter_defaults',
'name' => 'Filter defaults',
));
diff --git a/core/modules/quickedit/src/Tests/MetadataGeneratorTest.php b/core/modules/quickedit/src/Tests/MetadataGeneratorTest.php
index 0335703..17babee 100644
--- a/core/modules/quickedit/src/Tests/MetadataGeneratorTest.php
+++ b/core/modules/quickedit/src/Tests/MetadataGeneratorTest.php
@@ -10,6 +10,7 @@ namespace Drupal\quickedit\Tests;
use Drupal\quickedit\EditorSelector;
use Drupal\quickedit\MetadataGenerator;
use Drupal\quickedit_test\MockEditEntityFieldAccessCheck;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests in-place field editing metadata.
@@ -149,7 +150,7 @@ class MetadataGeneratorTest extends QuickEditTestBase {
);
// Create a text format.
- $full_html_format = entity_create('filter_format', array(
+ $full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
diff --git a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php
index 6e6fffb..57fc0ba 100644
--- a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php
+++ b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php
@@ -17,6 +17,7 @@ use Drupal\Core\Url;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\simpletest\WebTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests loading of in-place editing functionality and lazy loading of its
@@ -57,7 +58,7 @@ class QuickEditLoadingTest extends WebTestBase {
parent::setUp();
// Create a text format.
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
diff --git a/core/modules/search/src/Tests/SearchCommentTest.php b/core/modules/search/src/Tests/SearchCommentTest.php
index d7f7255..faec089 100644
--- a/core/modules/search/src/Tests/SearchCommentTest.php
+++ b/core/modules/search/src/Tests/SearchCommentTest.php
@@ -11,6 +11,7 @@ use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\field\Entity\FieldConfig;
use Drupal\user\RoleInterface;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests integration searching comments.
@@ -59,7 +60,7 @@ class SearchCommentTest extends SearchTestBase {
protected function setUp() {
parent::setUp();
- $full_html_format = entity_create('filter_format', array(
+ $full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
@@ -90,7 +91,7 @@ class SearchCommentTest extends SearchTestBase {
function testSearchResultsComment() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
// Create basic_html format that escapes all HTML.
- $basic_html_format = entity_create('filter_format', array(
+ $basic_html_format = FilterFormat::create(array(
'format' => 'basic_html',
'name' => 'Basic HTML',
'weight' => 1,
diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php
index 4f12cdf..6c9f0e9 100644
--- a/core/modules/search/src/Tests/SearchRankingTest.php
+++ b/core/modules/search/src/Tests/SearchRankingTest.php
@@ -10,6 +10,7 @@ namespace Drupal\search\Tests;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Core\Url;
+use Drupal\filter\Entity\FilterFormat;
/**
* Indexes content and tests ranking factors.
@@ -203,7 +204,7 @@ class SearchRankingTest extends SearchTestBase {
* Test rankings of HTML tags.
*/
public function testHTMLRankings() {
- $full_html_format = entity_create('filter_format', array(
+ $full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
));
diff --git a/core/modules/system/src/Tests/Form/FormTest.php b/core/modules/system/src/Tests/Form/FormTest.php
index f0e5af0..3e6821f 100644
--- a/core/modules/system/src/Tests/Form/FormTest.php
+++ b/core/modules/system/src/Tests/Form/FormTest.php
@@ -16,6 +16,7 @@ use Drupal\Core\Url;
use Drupal\form_test\Form\FormTestDisabledElementsForm;
use Drupal\simpletest\WebTestBase;
use Drupal\user\RoleInterface;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests various form element validation mechanisms.
@@ -34,7 +35,7 @@ class FormTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- $filtered_html_format = entity_create('filter_format', array(
+ $filtered_html_format = FilterFormat::create(array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
));
diff --git a/core/modules/text/src/Tests/Formatter/TextFormatterTest.php b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php
index eb141cb..ca44407 100644
--- a/core/modules/text/src/Tests/Formatter/TextFormatterTest.php
+++ b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php
@@ -46,7 +46,7 @@ class TextFormatterTest extends EntityUnitTestBase {
protected function setUp() {
parent::setUp();
- entity_create('filter_format', array(
+ FilterFormat::create(array(
'format' => 'my_text_format',
'name' => 'My text format',
'filters' => array(
diff --git a/core/modules/text/src/Tests/TextSummaryTest.php b/core/modules/text/src/Tests/TextSummaryTest.php
index 7b1dfab..bd39048 100644
--- a/core/modules/text/src/Tests/TextSummaryTest.php
+++ b/core/modules/text/src/Tests/TextSummaryTest.php
@@ -8,6 +8,7 @@
namespace Drupal\text\Tests;
use Drupal\simpletest\KernelTestBase;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests text_summary() with different strings and lengths.
@@ -55,7 +56,7 @@ class TextSummaryTest extends KernelTestBase {
* Test various summary length edge cases.
*/
function testLength() {
- entity_create('filter_format', array(
+ FilterFormat::create(array(
'format' => 'autop',
'filters' => array(
'filter_autop' => array(
@@ -63,7 +64,7 @@ class TextSummaryTest extends KernelTestBase {
),
),
))->save();
- entity_create('filter_format', array(
+ FilterFormat::create(array(
'format' => 'autop_correct',
'filters' => array(
'filter_autop' => array(
diff --git a/core/modules/text/src/Tests/TextWithSummaryItemTest.php b/core/modules/text/src/Tests/TextWithSummaryItemTest.php
index 1879919..cf42cbe 100644
--- a/core/modules/text/src/Tests/TextWithSummaryItemTest.php
+++ b/core/modules/text/src/Tests/TextWithSummaryItemTest.php
@@ -12,6 +12,7 @@ use Drupal\Core\Field\FieldItemInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\filter\Entity\FilterFormat;
/**
* Tests using entity fields of the text summary field type.
@@ -49,7 +50,7 @@ class TextWithSummaryItemTest extends FieldUnitTestBase {
// Create the necessary formats.
$this->installConfig(array('filter'));
- entity_create('filter_format', array(
+ FilterFormat::create(array(
'format' => 'no_filters',
'filters' => array(),
))->save();