From a79891dadf3eb1a43f25d7bae5fe5ddc2910934f Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Mon, 15 Feb 2016 08:43:00 +0900 Subject: [PATCH] Issue #2503411 by DuaelFr, Mac_Weber: Replace deprecated usage of entity_create('comment*') with a direct call to Comment/CommentType::create() --- core/modules/comment/src/Tests/CommentAdminTest.php | 5 +++-- core/modules/comment/src/Tests/CommentBookTest.php | 3 ++- core/modules/comment/src/Tests/CommentCSSTest.php | 3 ++- core/modules/comment/src/Tests/CommentCacheTagsTest.php | 2 +- .../src/Tests/CommentDefaultFormatterCacheTagsTest.php | 3 ++- core/modules/comment/src/Tests/CommentLinksTest.php | 3 ++- core/modules/comment/src/Tests/CommentNewIndicatorTest.php | 3 ++- core/modules/comment/src/Tests/CommentNonNodeTest.php | 2 +- .../comment/src/Tests/Views/CommentFieldFilterTest.php | 3 ++- .../comment/src/Tests/Views/CommentRestExportTest.php | 3 ++- core/modules/comment/src/Tests/Views/CommentTestBase.php | 3 ++- .../src/Tests/Views/DefaultViewRecentCommentsTest.php | 2 +- core/modules/forum/src/Tests/ForumBlockTest.php | 3 ++- core/modules/forum/src/Tests/ForumUninstallTest.php | 3 ++- core/modules/hal/src/Tests/EntityTest.php | 5 +++-- core/modules/node/src/Tests/NodeAccessPagerTest.php | 3 ++- core/modules/rdf/src/Tests/CommentAttributesTest.php | 3 ++- core/modules/rdf/src/Tests/StandardProfileTest.php | 3 ++- core/modules/system/src/Tests/Entity/EntityCrudHookTest.php | 2 +- .../EntityReferenceSelectionAccessTest.php | 3 ++- .../system/src/Tests/Theme/EntityFilteringThemeTest.php | 3 ++- core/modules/tracker/src/Tests/Views/TrackerTestBase.php | 3 ++- core/modules/user/src/Tests/UserCancelTest.php | 4 ++-- core/modules/views/src/Tests/DefaultViewsTest.php | 3 ++- core/modules/views/src/Tests/Entity/FieldEntityTest.php | 3 ++- .../views/src/Tests/Entity/ViewEntityDependenciesTest.php | 3 ++- 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 ee434f7bea17..37ed92ce9d0d 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 @@ function testApprovalAdminInterface() { // 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 @@ function testApprovalNodeInterface() { // 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 ecc26246680d..24581be569e3 100644 --- a/core/modules/comment/src/Tests/CommentBookTest.php +++ b/core/modules/comment/src/Tests/CommentBookTest.php @@ -9,6 +9,7 @@ use Drupal\comment\CommentInterface; use Drupal\simpletest\WebTestBase; +use Drupal\comment\Entity\Comment; /** * Tests visibility of comments on book pages. @@ -47,7 +48,7 @@ public function testBookCommentPrint() { $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 47a31cc50cc5..793762b41ff5 100644 --- a/core/modules/comment/src/Tests/CommentCSSTest.php +++ b/core/modules/comment/src/Tests/CommentCSSTest.php @@ -10,6 +10,7 @@ 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 @@ function testCommentClasses() { // 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 15142d8b682c..597e7ac31a93 100644 --- a/core/modules/comment/src/Tests/CommentCacheTagsTest.php +++ b/core/modules/comment/src/Tests/CommentCacheTagsTest.php @@ -77,7 +77,7 @@ protected function createEntity() { $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 1164ba0446e8..9dbba851e906 100644 --- a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php +++ b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php @@ -13,6 +13,7 @@ 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 @@ public function testCacheTags() { // 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 68f9f0eb7667..c21601dc9fcf 100644 --- a/core/modules/comment/src/Tests/CommentLinksTest.php +++ b/core/modules/comment/src/Tests/CommentLinksTest.php @@ -11,6 +11,7 @@ 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 @@ public function testCommentLinks() { // 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 46e2795b0e75..49c9e9e12fbc 100644 --- a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php +++ b/core/modules/comment/src/Tests/CommentNewIndicatorTest.php @@ -11,6 +11,7 @@ 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 @@ public function testCommentNewCommentsIndicator() { // 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 aa0694228364..c217fdc6ad3a 100644 --- a/core/modules/comment/src/Tests/CommentNonNodeTest.php +++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php @@ -54,7 +54,7 @@ protected function setUp() { // 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 4fd7d58e0948..03b31ff41cde 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 @@ function setUp() { '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 9737b4fbd021..b2f334c33125 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 @@ protected function setUp() { '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 202bf4727688..2067e2dc610e 100644 --- a/core/modules/comment/src/Tests/Views/CommentTestBase.php +++ b/core/modules/comment/src/Tests/Views/CommentTestBase.php @@ -10,6 +10,7 @@ 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 @@ protected function setUp() { '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 89b03b393c2d..bd52ef3c6394 100644 --- a/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php +++ b/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php @@ -84,7 +84,7 @@ protected function setUp() { // 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 f505bdf281c2..c0003d9051e0 100644 --- a/core/modules/forum/src/Tests/ForumBlockTest.php +++ b/core/modules/forum/src/Tests/ForumBlockTest.php @@ -9,6 +9,7 @@ use Drupal\simpletest\WebTestBase; use Drupal\Core\Datetime\DrupalDateTime; +use Drupal\comment\Entity\Comment; /** * Tests the forum blocks. @@ -97,7 +98,7 @@ public function testActiveForumTopicsBlock() { // 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 8eb13452f996..c3f18d00496b 100644 --- a/core/modules/forum/src/Tests/ForumUninstallTest.php +++ b/core/modules/forum/src/Tests/ForumUninstallTest.php @@ -11,6 +11,7 @@ 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 @@ public function testForumUninstallWithField() { )); // 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 6301fb05a5c8..ef0698b16ac4 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 @@ public function testComment() { )); $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 @@ public function testComment() { )); $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 c44256625575..6eb9efff00f8 100644 --- a/core/modules/node/src/Tests/NodeAccessPagerTest.php +++ b/core/modules/node/src/Tests/NodeAccessPagerTest.php @@ -10,6 +10,7 @@ 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 @@ public function testCommentPager() { // 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 8d3beb756455..552fbafe4e90 100644 --- a/core/modules/rdf/src/Tests/CommentAttributesTest.php +++ b/core/modules/rdf/src/Tests/CommentAttributesTest.php @@ -11,6 +11,7 @@ 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 @@ function saveComment($nid, $uid, $contact = NULL, $pid = 0) { $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 6ef3b53d3121..c1cd2a5b063e 100644 --- a/core/modules/rdf/src/Tests/StandardProfileTest.php +++ b/core/modules/rdf/src/Tests/StandardProfileTest.php @@ -12,6 +12,7 @@ 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 @@ protected function saveComment($nid, $uid, $contact = NULL, $pid = 0) { $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 2885d471b067..4b04e6b831b6 100644 --- a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php +++ b/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php @@ -163,7 +163,7 @@ public function testCommentHooks() { $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 46cc9527fc8d..0cb2fc0a397b 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\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 @@ public function testCommentHandler() { $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 ba366a3297c4..9a658c7fa472 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\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 @@ protected function setUp() { )); // 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 a8b36e8b8142..923fb0c8256c 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\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 @@ protected function setUp() { '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 d3be1af8aa04..3da74897929f 100644 --- a/core/modules/user/src/Tests/UserCancelTest.php +++ b/core/modules/user/src/Tests/UserCancelTest.php @@ -249,7 +249,7 @@ function testUserBlockUnpublish() { // 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 @@ function testUserAnonymize() { // 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 197d25e5adf9..12983f6cf6fd 100644 --- a/core/modules/views/src/Tests/DefaultViewsTest.php +++ b/core/modules/views/src/Tests/DefaultViewsTest.php @@ -15,6 +15,7 @@ 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 @@ protected function setUp() { '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 925ed10853ba..c121157f4543 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\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 @@ public function testGetEntity() { $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 b86aade086a4..a46e5092f362 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\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 @@ protected function setUp() { $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', -- GitLab