diff --git a/core/modules/comment/src/Tests/CommentPreviewTest.php b/core/modules/comment/src/Tests/CommentPreviewTest.php index 8d188c3..b5b089a 100644 --- a/core/modules/comment/src/Tests/CommentPreviewTest.php +++ b/core/modules/comment/src/Tests/CommentPreviewTest.php @@ -28,6 +28,48 @@ class CommentPreviewTest extends CommentTestBase { protected $profile = 'standard'; /** + * @todo remove setUp() once https://www.drupal.org/node/2321385 lands. + */ + protected function setUp() { + parent::setUp(); + $entity_type = 'node'; + $bundle = 'article'; + $field_name = 'comment'; + // Assign widget settings for the 'default' form mode. + entity_get_form_display($entity_type, $bundle, 'default') + ->setComponent($field_name, array( + 'type' => 'comment_default', + 'weight' => 20, + )) + ->save(); + + // The comment field should be hidden in all other form displays. + foreach (\Drupal::entityManager()->getFormModes($entity_type) as $id => $form_mode) { + $display = entity_get_form_display($entity_type, $bundle, $id); + // Only update existing displays. + if ($display && !$display->isNew()) { + $display->removeComponent($field_name)->save(); + } + } + // Set default to display comment list. + entity_get_display($entity_type, $bundle, 'default') + ->setComponent($field_name, array( + 'label' => 'above', + 'type' => 'comment_default', + 'weight' => 20, + )) + ->save(); + // The comment field should be hidden in all other view displays. + foreach (\Drupal::entityManager()->getViewModes($entity_type) as $id => $view_mode) { + $display = entity_get_display($entity_type, $bundle, $id); + // Only update existing displays. + if ($display && !$display->isNew()) { + $display->removeComponent($field_name)->save(); + } + } + } + + /** * Tests comment preview. */ function testCommentPreview() { diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php index 29e9804..f6f3320 100644 --- a/core/modules/rdf/src/Tests/StandardProfileTest.php +++ b/core/modules/rdf/src/Tests/StandardProfileTest.php @@ -104,6 +104,44 @@ class StandardProfileTest extends WebTestBase { protected function setUp() { parent::setUp(); + // @todo remove once https://www.drupal.org/node/2321385 lands. + $entity_type = 'node'; + $bundle = 'article'; + $field_name = 'comment'; + // Assign widget settings for the 'default' form mode. + entity_get_form_display($entity_type, $bundle, 'default') + ->setComponent($field_name, array( + 'type' => 'comment_default', + 'weight' => 20, + )) + ->save(); + + // The comment field should be hidden in all other form displays. + foreach (\Drupal::entityManager()->getFormModes($entity_type) as $id => $form_mode) { + $display = entity_get_form_display($entity_type, $bundle, $id); + // Only update existing displays. + if ($display && !$display->isNew()) { + $display->removeComponent($field_name)->save(); + } + } + // Set default to display comment list. + entity_get_display($entity_type, $bundle, 'default') + ->setComponent($field_name, array( + 'label' => 'above', + 'type' => 'comment_default', + 'weight' => 20, + )) + ->save(); + // The comment field should be hidden in all other view displays. + foreach (\Drupal::entityManager()->getViewModes($entity_type) as $id => $view_mode) { + $display = entity_get_display($entity_type, $bundle, $id); + // Only update existing displays. + if ($display && !$display->isNew()) { + $display->removeComponent($field_name)->save(); + } + } + // end @todo + $this->base_uri = \Drupal::url('', [], ['absolute' => TRUE]); // Create two test users. diff --git a/core/modules/user/src/Tests/UserPictureTest.php b/core/modules/user/src/Tests/UserPictureTest.php index 639c382..8ee3ff6 100644 --- a/core/modules/user/src/Tests/UserPictureTest.php +++ b/core/modules/user/src/Tests/UserPictureTest.php @@ -39,6 +39,43 @@ protected function setUp() { 'post comments', 'skip comment approval', )); + // @todo remove once https://www.drupal.org/node/2321385 lands. + $entity_type = 'node'; + $bundle = 'article'; + $field_name = 'comment'; + // Assign widget settings for the 'default' form mode. + entity_get_form_display($entity_type, $bundle, 'default') + ->setComponent($field_name, array( + 'type' => 'comment_default', + 'weight' => 20, + )) + ->save(); + + // The comment field should be hidden in all other form displays. + foreach (\Drupal::entityManager()->getFormModes($entity_type) as $id => $form_mode) { + $display = entity_get_form_display($entity_type, $bundle, $id); + // Only update existing displays. + if ($display && !$display->isNew()) { + $display->removeComponent($field_name)->save(); + } + } + // Set default to display comment list. + entity_get_display($entity_type, $bundle, 'default') + ->setComponent($field_name, array( + 'label' => 'above', + 'type' => 'comment_default', + 'weight' => 20, + )) + ->save(); + // The comment field should be hidden in all other view displays. + foreach (\Drupal::entityManager()->getViewModes($entity_type) as $id => $view_mode) { + $display = entity_get_display($entity_type, $bundle, $id); + // Only update existing displays. + if ($display && !$display->isNew()) { + $display->removeComponent($field_name)->save(); + } + } + // end @todo } /** diff --git a/core/profiles/standard/src/Tests/StandardTest.php b/core/profiles/standard/src/Tests/StandardTest.php index 3ba2347..8892c8b 100644 --- a/core/profiles/standard/src/Tests/StandardTest.php +++ b/core/profiles/standard/src/Tests/StandardTest.php @@ -23,6 +23,48 @@ class StandardTest extends WebTestBase { protected $profile = 'standard'; /** + * @todo remove setUp() once https://www.drupal.org/node/2321385 lands. + */ + protected function setUp() { + parent::setUp(); + $entity_type = 'node'; + $bundle = 'article'; + $field_name = 'comment'; + // Assign widget settings for the 'default' form mode. + entity_get_form_display($entity_type, $bundle, 'default') + ->setComponent($field_name, array( + 'type' => 'comment_default', + 'weight' => 20, + )) + ->save(); + + // The comment field should be hidden in all other form displays. + foreach (\Drupal::entityManager()->getFormModes($entity_type) as $id => $form_mode) { + $display = entity_get_form_display($entity_type, $bundle, $id); + // Only update existing displays. + if ($display && !$display->isNew()) { + $display->removeComponent($field_name)->save(); + } + } + // Set default to display comment list. + entity_get_display($entity_type, $bundle, 'default') + ->setComponent($field_name, array( + 'label' => 'above', + 'type' => 'comment_default', + 'weight' => 20, + )) + ->save(); + // The comment field should be hidden in all other view displays. + foreach (\Drupal::entityManager()->getViewModes($entity_type) as $id => $view_mode) { + $display = entity_get_display($entity_type, $bundle, $id); + // Only update existing displays. + if ($display && !$display->isNew()) { + $display->removeComponent($field_name)->save(); + } + } + } + + /** * Tests Standard installation profile. */ function testStandard() {