diff --git a/core/modules/comment/src/CommentTypeForm.php b/core/modules/comment/src/CommentTypeForm.php index 2e238ce..2454a87 100644 --- a/core/modules/comment/src/CommentTypeForm.php +++ b/core/modules/comment/src/CommentTypeForm.php @@ -48,7 +48,7 @@ public static function create(ContainerInterface $container) { * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager service. * @param \Drupal\Core\Logger\LoggerChannelInterface - * The logger channel + * The logger channel. */ function __construct(EntityManagerInterface $entity_manager, LoggerChannelInterface $logger) { $this->entityManager = $entity_manager; @@ -139,11 +139,11 @@ public function save(array $form, array &$form_state) { $edit_link = \Drupal::linkGenerator()->generateFromUrl($this->t('Edit'), $this->entity->urlInfo()); if ($status == SAVED_UPDATED) { drupal_set_message(t('Comment type %label has been updated.', array('%label' => $comment_type->label()))); - $this->logger->log(WATCHDOG_NOTICE, 'Comment type %label has been updated.', array('%label' => $comment_type->label(), 'link' => $edit_link)); + $this->logger->notice('Comment type %label has been updated.', array('%label' => $comment_type->label(), 'link' => $edit_link)); } else { drupal_set_message(t('Comment type %label has been added.', array('%label' => $comment_type->label()))); - $this->logger->log(WATCHDOG_NOTICE, 'Comment type %label has been added.', array('%label' => $comment_type->label(), 'link' => $edit_link)); + $this->logger->notice('Comment type %label has been added.', array('%label' => $comment_type->label(), 'link' => $edit_link)); } $form_state['redirect_route']['route_name'] = 'comment.type_list'; diff --git a/core/modules/comment/src/Form/CommentTypeDeleteForm.php b/core/modules/comment/src/Form/CommentTypeDeleteForm.php index cb2b4d1..9c32d2f 100644 --- a/core/modules/comment/src/Form/CommentTypeDeleteForm.php +++ b/core/modules/comment/src/Form/CommentTypeDeleteForm.php @@ -11,9 +11,9 @@ use Drupal\Core\Entity\EntityConfirmFormBase; use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\Query\QueryFactory; +use Drupal\Core\Logger\LoggerChannelInterface; use Drupal\Core\Url; use Drupal\field\Entity\FieldConfig; -use Drupal\Core\Logger\LoggerChannelInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -43,7 +43,7 @@ class CommentTypeDeleteForm extends EntityConfirmFormBase { protected $entityManager; /** - * The logger channel service. + * The comment channel logger. * * @var \Drupal\Core\Logger\LoggerChannelInterface */ @@ -65,8 +65,8 @@ class CommentTypeDeleteForm extends EntityConfirmFormBase { * The comment manager service. * @param \Drupal\Core\Entity\EntityManager $entity_manager * The entity manager service. - * @param \Drupal\Core\Logger\LoggerChannelInterface - * The logger channel + * @param \Drupal\Core\Logger\LoggerChannelInterface $logger + * The logger channel. */ public function __construct(QueryFactory $query_factory, CommentManagerInterface $comment_manager, EntityManager $entity_manager, LoggerChannelInterface $logger) { $this->queryFactory = $query_factory; @@ -143,8 +143,8 @@ public function buildForm(array $form, array &$form_state) { public function submit(array $form, array &$form_state) { $this->entity->delete(); $form_state['redirect_route']['route_name'] = 'comment.type_list'; - drupal_set_message(t('comment type %label has been deleted.', array('%label' => $this->entity->label()))); - $this->logger->log(WATCHDOG_NOTICE, 'comment type %label has been deleted.', array('%label' => $this->entity->label())); + drupal_set_message($this->t('Comment type %label has been deleted.', array('%label' => $this->entity->label()))); + $this->logger->notice('comment type %label has been deleted.', array('%label' => $this->entity->label())); } } diff --git a/core/modules/comment/src/Tests/CommentTypeTest.php b/core/modules/comment/src/Tests/CommentTypeTest.php index edc9456..1919fe2 100644 --- a/core/modules/comment/src/Tests/CommentTypeTest.php +++ b/core/modules/comment/src/Tests/CommentTypeTest.php @@ -174,12 +174,16 @@ public function testCommentTypeDeletion() { // Test exception thrown when re-using an existing comment type. try { \Drupal::service('comment.manager')->addDefaultField('comment', 'comment', 'bar'); + $this->fail('Exception not thrown.'); } catch (\InvalidArgumentException $e) { $this->pass('Exception thrown if attempting to re-use comment-type from another entity type.'); - return; } - $this->fail('Exception not thrown.'); + + // Delete the comment type. + $this->drupalPostForm('admin/structure/comment/manage/' . $type->id() . '/delete', array(), t('Delete')); + $this->assertNull(CommentType::load($type->id()), 'Comment type deleted.'); + $this->assertRaw(t('Comment type %label has been deleted.', array('%label' => $type->label()))); } } diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_type.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_type.yml index 18137ee..f11cd32 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_type.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_type.yml @@ -3,7 +3,9 @@ label: Drupal 6 comment type source: plugin: variable variables: - # We just need a single one of these, include a few to be sure. + # Ensure that we get at least one row to process by using variables that exist + # on every Drupal 6 site. We just need a single one of these, include a few to + # be sure. - site_name - menu_expanded - menu_masks diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php index 8d2d691..d07b02b 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php @@ -71,7 +71,7 @@ public function setUp() { } /** - * Tests the Drupal 6 to Drupal 6 comment migration. + * Tests the Drupal 6 to Drupal 8 comment migration. */ public function testComments() { /** @var Comment $comment */ diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTypeTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTypeTest.php index 0515888..9550df3 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTypeTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTypeTest.php @@ -49,7 +49,7 @@ public function setUp() { } /** - * Tests the Drupal 6 to Drupal 6 comment type migration. + * Tests the Drupal 6 to Drupal 8 comment type migration. */ public function testCommentType() { $comment_type = entity_load('comment_type', 'comment');