Permalink
Browse files

Merge remote-tracking branch 'upstream/7.x' into dev

  • Loading branch information...
lattera committed Jan 16, 2012
2 parents 0bc7e0d + 3cc2fc4 commit 2cf07a78806a7c4dbc946803e6d0321b8c1f8276
Showing with 55 additions and 58 deletions.
  1. +50 −50 modules/comment/comment.test
  2. +5 −7 modules/search/search.api.php
  3. +0 −1 modules/tracker/tracker.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 {
@@ -472,6 +422,56 @@ class CommentInterfaceTest extends CommentHelperCase {
$this->setCommentForm(FALSE);
}
+ /**
+ * 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.
*/
@@ -22,13 +22,11 @@
* on your module's type of content. If you want to have your content
* indexed in the standard search index, your module should also implement
* hook_update_index(). If your search type has settings, you can implement
- * hook_search_admin() to add them to the search settings page. You can also
- * alter the display of your module's search results by implementing
- * hook_search_page(). You can use hook_form_FORM_ID_alter(), with
- * FORM_ID set to 'search', to add fields to the search form (see
- * node_form_search_form_alter() for an example). You can use
- * hook_search_access() to limit access to searching, and hook_search_page() to
- * override how search results are displayed.
+ * hook_search_admin() to add them to the search settings page. You can use
+ * hook_form_FORM_ID_alter(), with FORM_ID set to 'search_form', to add fields
+ * to the search form (see node_form_search_form_alter() for an example).
+ * You can use hook_search_access() to limit access to searching,
+ * and hook_search_page() to override how search results are displayed.
*
* @return
* Array with optional keys:
@@ -8,7 +8,6 @@
class TrackerTest extends DrupalWebTestCase {
protected $user;
protected $other_user;
- protected $new_node;
public static function getInfo() {
return array(

0 comments on commit 2cf07a7

Please sign in to comment.