1 comment.test CommentFieldsTest::testCommentEnable()

Tests that comment module works when enabled after a content module.


core/modules/comment/tests/comment.test, line 2129
Tests for the Comment module.


Tests fields on comments.


function testCommentEnable() {
  // Create a user to do module administration.
  $this->admin_user = $this->backdropCreateUser(array('access administration pages', 'administer modules'));

  // Disable the comment module.
  $edit = array();
  $edit['modules[Comments][comment][enable]'] = FALSE;
  $this->backdropPost('admin/modules', $edit, t('Save configuration'));
  $this->assertFalse(module_exists('comment'), 'Comment module disabled.');

  // Enable core content type module: book.
  $edit = array();
  $edit['modules[System][book][enable]'] = 'book';
  $this->backdropPost('admin/modules', $edit, t('Save configuration'));

  // Now enable the comment module.
  $edit = array();
  $edit['modules[Comments][comment][enable]'] = 'comment';
  $this->backdropPost('admin/modules', $edit, t('Save configuration'));
  $this->assertTrue(module_exists('comment'), 'Comment module enabled.');

  // Create nodes of each type.
  $book_node = $this->backdropCreateNode(array('type' => 'book'));


  // Try to post a comment on each node. A failure will be triggered if the
  // comment body is missing on one of these forms, due to postComment()
  // asserting that the body is actually posted correctly.
  $this->web_user = $this->backdropCreateUser(array('access content', 'access comments', 'post comments', 'skip comment approval'));
  $this->postComment($book_node, $this->randomName(), '');