diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-01-14 01:02:36 -0500 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-01-14 01:02:36 -0500 |
commit | 2bdebdb7a57bfbd2c0580f22055275a4a3312baf (patch) | |
tree | 6888b50431b0eafedf8e71a7ccab61b1576a6a72 /modules/comment | |
parent | 86aa81e068f466e729830956bda7952b170663e4 (diff) | |
download | brdo-2bdebdb7a57bfbd2c0580f22055275a4a3312baf.tar.gz brdo-2bdebdb7a57bfbd2c0580f22055275a4a3312baf.tar.bz2 |
Issue #1399896 by xjm: Fixed testCommentNewCommentsIndicator() is inside CommentHelperCase and therefore gets run repeatedly.
Diffstat (limited to 'modules/comment')
-rw-r--r-- | modules/comment/comment.test | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/modules/comment/comment.test b/modules/comment/comment.test index f4e57c110..cc4687dc0 100644 --- a/modules/comment/comment.test +++ b/modules/comment/comment.test @@ -251,56 +251,6 @@ class CommentHelperCase extends DrupalWebTestCase { return $match[2]; } - - /** - * Tests new comment marker. - */ - public function testCommentNewCommentsIndicator() { - // Test if the right links are displayed when no comment is present for the - // node. - $this->drupalLogin($this->admin_user); - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_OPEN)); - $this->drupalGet('node'); - $this->assertNoLink(t('@count comments', array('@count' => 0))); - $this->assertNoLink(t('@count new comments', array('@count' => 0))); - $this->assertLink(t('Read more')); - $count = $this->xpath('//div[@id=:id]/div[@class=:class]/ul/li', array(':id' => 'node-' . $this->node->nid, ':class' => 'link-wrapper')); - $this->assertTrue(count($count) == 1, t('One child found')); - - // Create a new comment. This helper function may be run with different - // comment settings so use comment_save() to avoid complex setup. - $comment = (object) array( - 'cid' => NULL, - 'nid' => $this->node->nid, - 'node_type' => $this->node->type, - 'pid' => 0, - 'uid' => $this->loggedInUser->uid, - 'status' => COMMENT_PUBLISHED, - 'subject' => $this->randomName(), - 'hostname' => ip_address(), - 'language' => LANGUAGE_NONE, - 'comment_body' => array(LANGUAGE_NONE => array($this->randomName())), - ); - comment_save($comment); - $this->drupalLogout(); - - // Log in with 'web user' and check comment links. - $this->drupalLogin($this->web_user); - $this->drupalGet('node'); - $this->assertLink(t('1 new comment')); - $this->clickLink(t('1 new comment')); - $this->assertRaw('<a id="new"></a>', t('Found "new" marker.')); - $this->assertTrue($this->xpath('//a[@id=:new]/following-sibling::a[1][@id=:comment_id]', array(':new' => 'new', ':comment_id' => 'comment-1')), t('The "new" anchor is positioned at the right comment.')); - - // Test if "new comment" link is correctly removed. - $this->drupalGet('node'); - $this->assertLink(t('1 comment')); - $this->assertLink(t('Read more')); - $this->assertNoLink(t('1 new comment')); - $this->assertNoLink(t('@count new comments', array('@count' => 0))); - $count = $this->xpath('//div[@id=:id]/div[@class=:class]/ul/li', array(':id' => 'node-' . $this->node->nid, ':class' => 'link-wrapper')); - $this->assertTrue(count($count) == 2, print_r($count, TRUE)); - } } class CommentInterfaceTest extends CommentHelperCase { @@ -473,6 +423,56 @@ class CommentInterfaceTest extends CommentHelperCase { } /** + * Tests new comment marker. + */ + public function testCommentNewCommentsIndicator() { + // Test if the right links are displayed when no comment is present for the + // node. + $this->drupalLogin($this->admin_user); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_OPEN)); + $this->drupalGet('node'); + $this->assertNoLink(t('@count comments', array('@count' => 0))); + $this->assertNoLink(t('@count new comments', array('@count' => 0))); + $this->assertLink(t('Read more')); + $count = $this->xpath('//div[@id=:id]/div[@class=:class]/ul/li', array(':id' => 'node-' . $this->node->nid, ':class' => 'link-wrapper')); + $this->assertTrue(count($count) == 1, t('One child found')); + + // Create a new comment. This helper function may be run with different + // comment settings so use comment_save() to avoid complex setup. + $comment = (object) array( + 'cid' => NULL, + 'nid' => $this->node->nid, + 'node_type' => $this->node->type, + 'pid' => 0, + 'uid' => $this->loggedInUser->uid, + 'status' => COMMENT_PUBLISHED, + 'subject' => $this->randomName(), + 'hostname' => ip_address(), + 'language' => LANGUAGE_NONE, + 'comment_body' => array(LANGUAGE_NONE => array($this->randomName())), + ); + comment_save($comment); + $this->drupalLogout(); + + // Log in with 'web user' and check comment links. + $this->drupalLogin($this->web_user); + $this->drupalGet('node'); + $this->assertLink(t('1 new comment')); + $this->clickLink(t('1 new comment')); + $this->assertRaw('<a id="new"></a>', t('Found "new" marker.')); + $this->assertTrue($this->xpath('//a[@id=:new]/following-sibling::a[1][@id=:comment_id]', array(':new' => 'new', ':comment_id' => 'comment-1')), t('The "new" anchor is positioned at the right comment.')); + + // Test if "new comment" link is correctly removed. + $this->drupalGet('node'); + $this->assertLink(t('1 comment')); + $this->assertLink(t('Read more')); + $this->assertNoLink(t('1 new comment')); + $this->assertNoLink(t('@count new comments', array('@count' => 0))); + $count = $this->xpath('//div[@id=:id]/div[@class=:class]/ul/li', array(':id' => 'node-' . $this->node->nid, ':class' => 'link-wrapper')); + $this->assertTrue(count($count) == 2, print_r($count, TRUE)); + } + + /** * Tests the node comment statistics. */ function testCommentNodeCommentStatistics() { |