You are here

public function NodeCommentBlockWebTest::testAuthenticatedUsers in Node Comment Block 7.2

Test displaying the comments block for authenticated users.

File

./node_comment_block.test, line 46
Tests for node_comment_block.module

Class

NodeCommentBlockWebTest
Functional tests for node_comment_block.

Code

public function testAuthenticatedUsers() {
  $this
    ->drupalLogin($this
    ->drupalCreateUser(array(
    'administer blocks',
    'post comments',
  )));
  $this
    ->drupalCreateNode(array(
    'type' => 'article',
  ));

  // The comments form should be hidden by default with the module enabled.
  $this
    ->drupalGet('node/1');
  $this
    ->assertNoText(self::COMMENT_BLOCK_SUBJECT, 'The comment block is not visible.');

  // Place the node comments block into a region.
  $this
    ->drupalPost(self::BLOCK_CONFIGURE_PATH, array(
    'regions[bartik]' => 'sidebar_second',
  ), t('Save block'));

  // The comments form should now be visible in the block.
  $this
    ->drupalGet('node/1');
  $this
    ->assertRaw(self::COMMENT_BLOCK_HTML, 'The comment block is visible.');
  $this
    ->assertText(self::COMMENT_BLOCK_SUBJECT, 'The comment block subject is visible.');
}