diff --git a/core/modules/node/src/Tests/PagePreviewTest.php b/core/modules/node/src/Tests/PagePreviewTest.php index f8c6c7b..d47212e 100644 --- a/core/modules/node/src/Tests/PagePreviewTest.php +++ b/core/modules/node/src/Tests/PagePreviewTest.php @@ -7,6 +7,7 @@ namespace Drupal\node\Tests; +use Drupal\comment\Tests\CommentTestTrait; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Component\Utility\Unicode; use Drupal\Core\Language\LanguageInterface; @@ -20,14 +21,15 @@ */ class PagePreviewTest extends NodeTestBase { + use CommentTestTrait; use EntityReferenceTestTrait; /** - * Enable the node and taxonomy modules to test both on the preview. + * Enable the node, taxonomy and comment modules to test on the preview. * * @var array */ - public static $modules = array('node', 'taxonomy'); + public static $modules = array('node', 'taxonomy', 'comment'); /** * The name of the created field. @@ -39,7 +41,7 @@ class PagePreviewTest extends NodeTestBase { protected function setUp() { parent::setUp(); - $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content')); + $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content', 'post comments')); $this->drupalLogin($web_user); // Add a vocabulary so we can test different view modes. @@ -75,6 +77,8 @@ protected function setUp() { ); $this->createEntityReferenceField('node', 'page', $this->fieldName, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); + $this->addDefaultCommentField('node', 'page'); + entity_get_form_display('node', 'page', 'default') ->setComponent($this->fieldName, array( 'type' => 'entity_reference_autocomplete_tags',