CommentNodeChangesTest.php

Definition of Drupal\comment\Tests\CommentNodeChangesTest.

Namespace

Drupal\comment\Tests

File

drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeChangesTest.php
View source
<?php

/**
 * @file
 * Definition of Drupal\comment\Tests\CommentNodeChangesTest.
 */
namespace Drupal\comment\Tests;


/**
 * Tests that comments behave correctly when the node is changed.
 */
class CommentNodeChangesTest extends CommentTestBase {
  public static function getInfo() {
    return array(
      'name' => 'Comment deletion on node changes',
      'description' => 'Tests that comments behave correctly when the node is changed.',
      'group' => 'Comment',
    );
  }

  /**
   * Tests that comments are deleted with the node.
   */
  function testNodeDeletion() {
    $this
      ->drupalLogin($this->web_user);
    $comment = $this
      ->postComment($this->node, $this
      ->randomName(), $this
      ->randomName());
    $this
      ->assertTrue(comment_load($comment->id), 'The comment could be loaded.');
    node_delete($this->node->nid);
    $this
      ->assertFalse(comment_load($comment->id), 'The comment could not be loaded after the node was deleted.');
  }

}

Classes

Namesort descending Description
CommentNodeChangesTest Tests that comments behave correctly when the node is changed.