summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-02-14 23:43:00 (GMT)
committerNathaniel Catchpole2016-02-14 23:43:00 (GMT)
commita79891dadf3eb1a43f25d7bae5fe5ddc2910934f (patch)
treec9946e32e3a57b10e16fba92b6f6b4883554d716
parent3c4b6ab1293b85b5b5414b72d66324253488cc65 (diff)
Issue #2503411 by DuaelFr, Mac_Weber: Replace deprecated usage of entity_create('comment*') with a direct call to Comment/CommentType::create()
-rw-r--r--core/modules/comment/src/Tests/CommentAdminTest.php5
-rw-r--r--core/modules/comment/src/Tests/CommentBookTest.php3
-rw-r--r--core/modules/comment/src/Tests/CommentCSSTest.php3
-rw-r--r--core/modules/comment/src/Tests/CommentCacheTagsTest.php2
-rw-r--r--core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php3
-rw-r--r--core/modules/comment/src/Tests/CommentLinksTest.php3
-rw-r--r--core/modules/comment/src/Tests/CommentNewIndicatorTest.php3
-rw-r--r--core/modules/comment/src/Tests/CommentNonNodeTest.php2
-rw-r--r--core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php3
-rw-r--r--core/modules/comment/src/Tests/Views/CommentRestExportTest.php3
-rw-r--r--core/modules/comment/src/Tests/Views/CommentTestBase.php3
-rw-r--r--core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php2
-rw-r--r--core/modules/forum/src/Tests/ForumBlockTest.php3
-rw-r--r--core/modules/forum/src/Tests/ForumUninstallTest.php3
-rw-r--r--core/modules/hal/src/Tests/EntityTest.php5
-rw-r--r--core/modules/node/src/Tests/NodeAccessPagerTest.php3
-rw-r--r--core/modules/rdf/src/Tests/CommentAttributesTest.php3
-rw-r--r--core/modules/rdf/src/Tests/StandardProfileTest.php3
-rw-r--r--core/modules/system/src/Tests/Entity/EntityCrudHookTest.php2
-rw-r--r--core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php3
-rw-r--r--core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php3
-rw-r--r--core/modules/tracker/src/Tests/Views/TrackerTestBase.php3
-rw-r--r--core/modules/user/src/Tests/UserCancelTest.php4
-rw-r--r--core/modules/views/src/Tests/DefaultViewsTest.php3
-rw-r--r--core/modules/views/src/Tests/Entity/FieldEntityTest.php3
-rw-r--r--core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php3
26 files changed, 50 insertions, 29 deletions
diff --git a/core/modules/comment/src/Tests/CommentAdminTest.php b/core/modules/comment/src/Tests/CommentAdminTest.php
index ee434f7..37ed92c 100644
--- a/core/modules/comment/src/Tests/CommentAdminTest.php
+++ b/core/modules/comment/src/Tests/CommentAdminTest.php
@@ -8,6 +8,7 @@
namespace Drupal\comment\Tests;
use Drupal\user\RoleInterface;
+use Drupal\comment\Entity\Comment;
/**
* Tests comment approval functionality.
@@ -50,7 +51,7 @@ class CommentAdminTest extends CommentTestBase {
// Get unapproved comment id.
$this->drupalLogin($this->adminUser);
$anonymous_comment4 = $this->getUnapprovedComment($subject);
- $anonymous_comment4 = entity_create('comment', array(
+ $anonymous_comment4 = Comment::create(array(
'cid' => $anonymous_comment4,
'subject' => $subject,
'comment_body' => $body,
@@ -127,7 +128,7 @@ class CommentAdminTest extends CommentTestBase {
// Get unapproved comment id.
$this->drupalLogin($this->adminUser);
$anonymous_comment4 = $this->getUnapprovedComment($subject);
- $anonymous_comment4 = entity_create('comment', array(
+ $anonymous_comment4 = Comment::create(array(
'cid' => $anonymous_comment4,
'subject' => $subject,
'comment_body' => $body,
diff --git a/core/modules/comment/src/Tests/CommentBookTest.php b/core/modules/comment/src/Tests/CommentBookTest.php
index ecc2624..24581be 100644
--- a/core/modules/comment/src/Tests/CommentBookTest.php
+++ b/core/modules/comment/src/Tests/CommentBookTest.php
@@ -9,6 +9,7 @@ namespace Drupal\comment\Tests;
use Drupal\comment\CommentInterface;
use Drupal\simpletest\WebTestBase;
+use Drupal\comment\Entity\Comment;
/**
* Tests visibility of comments on book pages.
@@ -47,7 +48,7 @@ class CommentBookTest extends WebTestBase {
$comment_subject = $this->randomMachineName(8);
$comment_body = $this->randomMachineName(8);
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'subject' => $comment_subject,
'comment_body' => $comment_body,
'entity_id' => $book_node->id(),
diff --git a/core/modules/comment/src/Tests/CommentCSSTest.php b/core/modules/comment/src/Tests/CommentCSSTest.php
index 47a31cc..793762b 100644
--- a/core/modules/comment/src/Tests/CommentCSSTest.php
+++ b/core/modules/comment/src/Tests/CommentCSSTest.php
@@ -10,6 +10,7 @@ namespace Drupal\comment\Tests;
use Drupal\Core\Language\LanguageInterface;
use Drupal\comment\CommentInterface;
use Drupal\user\RoleInterface;
+use Drupal\comment\Entity\Comment;
/**
* Tests CSS classes on comments.
@@ -47,7 +48,7 @@ class CommentCSSTest extends CommentTestBase {
// Add a comment.
/** @var \Drupal\comment\CommentInterface $comment */
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'entity_id' => $node->id(),
'entity_type' => 'node',
'field_name' => 'comment',
diff --git a/core/modules/comment/src/Tests/CommentCacheTagsTest.php b/core/modules/comment/src/Tests/CommentCacheTagsTest.php
index 15142d8..597e7ac 100644
--- a/core/modules/comment/src/Tests/CommentCacheTagsTest.php
+++ b/core/modules/comment/src/Tests/CommentCacheTagsTest.php
@@ -77,7 +77,7 @@ class CommentCacheTagsTest extends EntityWithUriCacheTagsTestBase {
$this->entityTestCamelid->save();
// Create a "Llama" comment.
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'subject' => 'Llama',
'comment_body' => array(
'value' => 'The name "llama" was adopted by European settlers from native Peruvians.',
diff --git a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
index 1164ba0..9dbba85 100644
--- a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
+++ b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
@@ -13,6 +13,7 @@ use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\Session;
+use Drupal\comment\Entity\Comment;
/**
* Tests the bubbling up of comment cache tags when using the Comment list
@@ -98,7 +99,7 @@ class CommentDefaultFormatterCacheTagsTest extends EntityUnitTestBase {
// also exists in the {users} table.
$user = $this->createUser();
$user->save();
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'subject' => 'Llama',
'comment_body' => array(
'value' => 'Llamas are cool!',
diff --git a/core/modules/comment/src/Tests/CommentLinksTest.php b/core/modules/comment/src/Tests/CommentLinksTest.php
index 68f9f0e..c21601d 100644
--- a/core/modules/comment/src/Tests/CommentLinksTest.php
+++ b/core/modules/comment/src/Tests/CommentLinksTest.php
@@ -11,6 +11,7 @@ use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\comment\CommentInterface;
use Drupal\user\RoleInterface;
+use Drupal\comment\Entity\Comment;
/**
* Basic comment links tests to ensure markup present.
@@ -59,7 +60,7 @@ class CommentLinksTest extends CommentTestBase {
// Create a comment via CRUD API functionality, since
// $this->postComment() relies on actual user permissions.
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'cid' => NULL,
'entity_id' => $this->node->id(),
'entity_type' => 'node',
diff --git a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php b/core/modules/comment/src/Tests/CommentNewIndicatorTest.php
index 46e2795..49c9e9e 100644
--- a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php
+++ b/core/modules/comment/src/Tests/CommentNewIndicatorTest.php
@@ -11,6 +11,7 @@ use Drupal\Component\Serialization\Json;
use Drupal\Core\Language\LanguageInterface;
use Drupal\comment\CommentInterface;
use Drupal\Core\Url;
+use Drupal\comment\Entity\Comment;
/**
* Tests the 'new' indicator posted on comments.
@@ -85,7 +86,7 @@ class CommentNewIndicatorTest extends CommentTestBase {
// Create a new comment. This helper function may be run with different
// comment settings so use $comment->save() to avoid complex setup.
/** @var \Drupal\comment\CommentInterface $comment */
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'cid' => NULL,
'entity_id' => $this->node->id(),
'entity_type' => 'node',
diff --git a/core/modules/comment/src/Tests/CommentNonNodeTest.php b/core/modules/comment/src/Tests/CommentNonNodeTest.php
index aa06942..c217fdc 100644
--- a/core/modules/comment/src/Tests/CommentNonNodeTest.php
+++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php
@@ -54,7 +54,7 @@ class CommentNonNodeTest extends WebTestBase {
// Create a bundle for entity_test.
entity_test_create_bundle('entity_test', 'Entity Test', 'entity_test');
- entity_create('comment_type', array(
+ CommentType::create(array(
'id' => 'comment',
'label' => 'Comment settings',
'description' => 'Comment settings',
diff --git a/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php b/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php
index 4fd7d58..03b31ff 100644
--- a/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php
+++ b/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php
@@ -8,6 +8,7 @@
namespace Drupal\comment\Tests\Views;
use Drupal\language\Entity\ConfigurableLanguage;
+use Drupal\comment\Entity\Comment;
/**
* Tests comment field filters with translations.
@@ -61,7 +62,7 @@ class CommentFieldFilterTest extends CommentTestBase {
'pid' => '',
'node_type' => '',
);
- $this->comment = entity_create('comment', $comment);
+ $this->comment = Comment::create($comment);
// Add field values and translate the comment.
$this->comment->subject->value = $this->commentTitles['en'];
diff --git a/core/modules/comment/src/Tests/Views/CommentRestExportTest.php b/core/modules/comment/src/Tests/Views/CommentRestExportTest.php
index 9737b4f..b2f334c 100644
--- a/core/modules/comment/src/Tests/Views/CommentRestExportTest.php
+++ b/core/modules/comment/src/Tests/Views/CommentRestExportTest.php
@@ -8,6 +8,7 @@
namespace Drupal\comment\Tests\Views;
use Drupal\Component\Serialization\Json;
+use Drupal\comment\Entity\Comment;
/**
* Tests a comment rest export view.
@@ -43,7 +44,7 @@ class CommentRestExportTest extends CommentTestBase {
'name' => 'bobby tables',
'hostname' => 'public.example.com',
);
- $this->comment = entity_create('comment', $comment);
+ $this->comment = Comment::create($comment);
$this->comment->save();
$user = $this->drupalCreateUser(['access comments']);
diff --git a/core/modules/comment/src/Tests/Views/CommentTestBase.php b/core/modules/comment/src/Tests/Views/CommentTestBase.php
index 202bf47..2067e2d 100644
--- a/core/modules/comment/src/Tests/Views/CommentTestBase.php
+++ b/core/modules/comment/src/Tests/Views/CommentTestBase.php
@@ -10,6 +10,7 @@ namespace Drupal\comment\Tests\Views;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
+use Drupal\comment\Entity\Comment;
/**
* Tests the argument_comment_user_uid handler.
@@ -87,7 +88,7 @@ abstract class CommentTestBase extends ViewTestBase {
'pid' => '',
'mail' => 'someone@example.com',
);
- $this->comment = entity_create('comment', $comment);
+ $this->comment = Comment::create($comment);
$this->comment->save();
}
diff --git a/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php b/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php
index 89b03b3..bd52ef3 100644
--- a/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php
+++ b/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php
@@ -84,7 +84,7 @@ class DefaultViewRecentCommentsTest extends ViewTestBase {
// Create some comments and attach them to the created node.
for ($i = 0; $i < $this->masterDisplayResults; $i++) {
/** @var \Drupal\comment\CommentInterface $comment */
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'status' => CommentInterface::PUBLISHED,
'field_name' => 'comment',
'entity_type' => 'node',
diff --git a/core/modules/forum/src/Tests/ForumBlockTest.php b/core/modules/forum/src/Tests/ForumBlockTest.php
index f505bdf..c0003d9 100644
--- a/core/modules/forum/src/Tests/ForumBlockTest.php
+++ b/core/modules/forum/src/Tests/ForumBlockTest.php
@@ -9,6 +9,7 @@ namespace Drupal\forum\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\comment\Entity\Comment;
/**
* Tests the forum blocks.
@@ -97,7 +98,7 @@ class ForumBlockTest extends WebTestBase {
// Get the node from the topic title.
$node = $this->drupalGetNodeByTitle($topics[$index]);
$date->modify('+1 minute');
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'entity_id' => $node->id(),
'field_name' => 'comment_forum',
'entity_type' => 'node',
diff --git a/core/modules/forum/src/Tests/ForumUninstallTest.php b/core/modules/forum/src/Tests/ForumUninstallTest.php
index 8eb1345..c3f18d0 100644
--- a/core/modules/forum/src/Tests/ForumUninstallTest.php
+++ b/core/modules/forum/src/Tests/ForumUninstallTest.php
@@ -11,6 +11,7 @@ use Drupal\comment\CommentInterface;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\node\Entity\NodeType;
use Drupal\simpletest\WebTestBase;
+use Drupal\comment\Entity\Comment;
/**
* Tests forum module uninstallation.
@@ -54,7 +55,7 @@ class ForumUninstallTest extends WebTestBase {
));
// Create at least one comment against the forum node.
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'entity_id' => $node->nid->value,
'entity_type' => 'node',
'field_name' => 'comment_forum',
diff --git a/core/modules/hal/src/Tests/EntityTest.php b/core/modules/hal/src/Tests/EntityTest.php
index 6301fb0..ef0698b 100644
--- a/core/modules/hal/src/Tests/EntityTest.php
+++ b/core/modules/hal/src/Tests/EntityTest.php
@@ -8,6 +8,7 @@
namespace Drupal\hal\Tests;
use Drupal\comment\Tests\CommentTestTrait;
+use Drupal\comment\Entity\Comment;
/**
* Tests that nodes and terms are correctly normalized and denormalized.
@@ -167,7 +168,7 @@ class EntityTest extends NormalizerTestBase {
));
$node->save();
- $parent_comment = entity_create('comment', array(
+ $parent_comment = Comment::create(array(
'uid' => $account->id(),
'subject' => $this->randomMachineName(),
'comment_body' => [
@@ -180,7 +181,7 @@ class EntityTest extends NormalizerTestBase {
));
$parent_comment->save();
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'uid' => $account->id(),
'subject' => $this->randomMachineName(),
'comment_body' => [
diff --git a/core/modules/node/src/Tests/NodeAccessPagerTest.php b/core/modules/node/src/Tests/NodeAccessPagerTest.php
index c442566..6eb9eff 100644
--- a/core/modules/node/src/Tests/NodeAccessPagerTest.php
+++ b/core/modules/node/src/Tests/NodeAccessPagerTest.php
@@ -10,6 +10,7 @@ namespace Drupal\node\Tests;
use Drupal\comment\CommentInterface;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\simpletest\WebTestBase;
+use Drupal\comment\Entity\Comment;
/**
* Tests access controlled node views have the right amount of comment pages.
@@ -45,7 +46,7 @@ class NodeAccessPagerTest extends WebTestBase {
// Create 60 comments.
for ($i = 0; $i < 60; $i++) {
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'entity_id' => $node->id(),
'entity_type' => 'node',
'field_name' => 'comment',
diff --git a/core/modules/rdf/src/Tests/CommentAttributesTest.php b/core/modules/rdf/src/Tests/CommentAttributesTest.php
index 8d3beb7..552fbaf 100644
--- a/core/modules/rdf/src/Tests/CommentAttributesTest.php
+++ b/core/modules/rdf/src/Tests/CommentAttributesTest.php
@@ -11,6 +11,7 @@ use Drupal\comment\CommentInterface;
use Drupal\comment\CommentManagerInterface;
use Drupal\comment\Tests\CommentTestBase;
use Drupal\user\RoleInterface;
+use Drupal\comment\Entity\Comment;
/**
* Tests the RDFa markup of comments.
@@ -372,7 +373,7 @@ class CommentAttributesTest extends CommentTestBase {
$values += $contact;
}
- $comment = entity_create('comment', $values);
+ $comment = Comment::create($values);
$comment->save();
return $comment;
}
diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php
index 6ef3b53..c1cd2a5 100644
--- a/core/modules/rdf/src/Tests/StandardProfileTest.php
+++ b/core/modules/rdf/src/Tests/StandardProfileTest.php
@@ -12,6 +12,7 @@ use Drupal\image\Entity\ImageStyle;
use Drupal\node\Entity\NodeType;
use Drupal\node\NodeInterface;
use Drupal\simpletest\WebTestBase;
+use Drupal\comment\Entity\Comment;
/**
* Tests the RDF mappings and RDFa markup of the standard profile.
@@ -515,7 +516,7 @@ class StandardProfileTest extends WebTestBase {
$values += $contact;
}
- $comment = entity_create('comment', $values);
+ $comment = Comment::create($values);
$comment->save();
return $comment;
}
diff --git a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
index 2885d47..4b04e6b 100644
--- a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
@@ -163,7 +163,7 @@ class EntityCrudHookTest extends EntityUnitTestBase {
$nid = $node->id();
$GLOBALS['entity_crud_hook_test'] = array();
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'cid' => NULL,
'pid' => 0,
'entity_id' => $nid,
diff --git a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php
index 46cc952..0cb2fc0 100644
--- a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php
@@ -13,6 +13,7 @@ use Drupal\Core\Language\LanguageInterface;
use Drupal\comment\CommentInterface;
use Drupal\simpletest\WebTestBase;
use Drupal\user\Entity\User;
+use Drupal\comment\Entity\Comment;
/**
* Tests for the base handlers provided by Entity Reference.
@@ -413,7 +414,7 @@ class EntityReferenceSelectionAccessTest extends WebTestBase {
$comments = array();
$comment_labels = array();
foreach ($comment_values as $key => $values) {
- $comment = entity_create('comment', $values);
+ $comment = Comment::create($values);
$comment->save();
$comments[$key] = $comment;
$comment_labels[$key] = Html::escape($comment->label());
diff --git a/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php b/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
index ba366a3..9a658c7 100644
--- a/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
+++ b/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
@@ -12,6 +12,7 @@ use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\comment\CommentInterface;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\simpletest\WebTestBase;
+use Drupal\comment\Entity\Comment;
/**
* Tests themed output for each entity type in all available themes to ensure
@@ -110,7 +111,7 @@ class EntityFilteringThemeTest extends WebTestBase {
));
// Create a test comment on the test node.
- $this->comment = entity_create('comment', array(
+ $this->comment = Comment::create(array(
'entity_id' => $this->node->id(),
'entity_type' => 'node',
'field_name' => 'comment',
diff --git a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
index a8b36e8..923fb0c 100644
--- a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
+++ b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
@@ -11,6 +11,7 @@ use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Core\Language\LanguageInterface;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
+use Drupal\comment\Entity\Comment;
/**
* Base class for all tracker tests.
@@ -60,7 +61,7 @@ abstract class TrackerTestBase extends ViewTestBase {
'status' => 1,
));
- $this->comment = entity_create('comment', array(
+ $this->comment = Comment::create(array(
'entity_id' => $this->node->id(),
'entity_type' => 'node',
'field_name' => 'comment',
diff --git a/core/modules/user/src/Tests/UserCancelTest.php b/core/modules/user/src/Tests/UserCancelTest.php
index d3be1af..3da7489 100644
--- a/core/modules/user/src/Tests/UserCancelTest.php
+++ b/core/modules/user/src/Tests/UserCancelTest.php
@@ -249,7 +249,7 @@ class UserCancelTest extends WebTestBase {
// Add a comment to the page.
$comment_subject = $this->randomMachineName(8);
$comment_body = $this->randomMachineName(8);
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'subject' => $comment_subject,
'comment_body' => $comment_body,
'entity_id' => $node->id(),
@@ -316,7 +316,7 @@ class UserCancelTest extends WebTestBase {
// Add a comment to the page.
$comment_subject = $this->randomMachineName(8);
$comment_body = $this->randomMachineName(8);
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'subject' => $comment_subject,
'comment_body' => $comment_body,
'entity_id' => $node->id(),
diff --git a/core/modules/views/src/Tests/DefaultViewsTest.php b/core/modules/views/src/Tests/DefaultViewsTest.php
index 197d25e..12983f6 100644
--- a/core/modules/views/src/Tests/DefaultViewsTest.php
+++ b/core/modules/views/src/Tests/DefaultViewsTest.php
@@ -15,6 +15,7 @@ use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\views\Views;
+use Drupal\comment\Entity\Comment;
/**
* Tests the default views provided by views.
@@ -101,7 +102,7 @@ class DefaultViewsTest extends ViewTestBase {
'entity_type' => 'node',
'field_name' => 'comment'
);
- entity_create('comment', $comment)->save();
+ Comment::create($comment)->save();
}
// Some views, such as the "Who's Online" view, only return results if at
diff --git a/core/modules/views/src/Tests/Entity/FieldEntityTest.php b/core/modules/views/src/Tests/Entity/FieldEntityTest.php
index 925ed10..c121157 100644
--- a/core/modules/views/src/Tests/Entity/FieldEntityTest.php
+++ b/core/modules/views/src/Tests/Entity/FieldEntityTest.php
@@ -11,6 +11,7 @@ use Drupal\comment\Tests\CommentTestTrait;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Views;
+use Drupal\comment\Entity\Comment;
/**
* Tests the field plugin base integration with the entity system.
@@ -59,7 +60,7 @@ class FieldEntityTest extends ViewTestBase {
$node = entity_create('node', array('uid' => $account->id(), 'type' => 'page', 'title' => $this->randomString()));
$node->save();
- $comment = entity_create('comment', array(
+ $comment = Comment::create(array(
'uid' => $account->id(),
'entity_id' => $node->id(),
'entity_type' => 'node',
diff --git a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
index b86aade..a46e509 100644
--- a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
+++ b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
@@ -12,6 +12,7 @@ use Drupal\field\Entity\FieldStorageConfig;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\views\Views;
+use Drupal\comment\Entity\CommentType;
/**
* Tests the calculation of dependencies for views.
@@ -44,7 +45,7 @@ class ViewEntityDependenciesTest extends ViewKernelTestBase {
$this->installEntitySchema('node');
$this->installConfig(array('field', 'node'));
- $comment_type = entity_create('comment_type', array(
+ $comment_type = CommentType::create(array(
'id' => 'comment',
'label' => 'Comment settings',
'description' => 'Comment settings',