diff --git a/modules/tracker/tracker.install b/modules/tracker/tracker.install index cfe8dc7..8896670 100644 --- a/modules/tracker/tracker.install +++ b/modules/tracker/tracker.install @@ -1,6 +1,11 @@ nid, $node->uid, $node->changed); @@ -171,6 +194,8 @@ function tracker_node_insert($node, $arg = 0) { /** * Implements hook_node_update(). + * + * Add tracking information for this node since it's been updated. */ function tracker_node_update($node, $arg = 0) { _tracker_add($node->nid, $node->uid, $node->changed); @@ -178,6 +203,8 @@ function tracker_node_update($node, $arg = 0) { /** * Implements hook_node_delete(). + * + * Delete tracking information for a node. */ function tracker_node_delete($node, $arg = 0) { db_delete('tracker_node') @@ -227,7 +254,7 @@ function tracker_comment_delete($comment) { } /** - * Update indexing tables when a node is added, updated or commented on. + * Updates indexing tables when a node is added, updated or commented on. * * @param $nid * A node ID. @@ -266,7 +293,7 @@ function _tracker_add($nid, $uid, $changed) { } /** - * Determine the max timestamp between $node->changed and the last comment. + * Determines the max timestamp between $node->changed and the last comment. * * @param $nid * A node ID. @@ -288,7 +315,7 @@ function _tracker_calculate_changed($nid) { } /** - * Clean up indexed data when nodes or comments are removed. + * Cleans up indexed data when nodes or comments are removed. * * @param $nid * The node ID. diff --git a/modules/tracker/tracker.pages.inc b/modules/tracker/tracker.pages.inc index 7b1e946..26b7fd5 100644 --- a/modules/tracker/tracker.pages.inc +++ b/modules/tracker/tracker.pages.inc @@ -7,7 +7,15 @@ /** - * Menu callback; prints a listing of active nodes on the site. + * Prints a listing of active nodes on the site. This is a menu callback. + * + * Display a page of tracked information. Query the database for info, + * add RDFa info if applicable, and generate the render array that will be + * used to render the page. + * + * @return array $page + * Returns an array that can be rendered; it will be themed by a call to + * page_theme(). */ function tracker_page($account = NULL, $set_title = FALSE) { if ($account) { diff --git a/modules/tracker/tracker.test b/modules/tracker/tracker.test index 3cc227e..5a8d93b 100644 --- a/modules/tracker/tracker.test +++ b/modules/tracker/tracker.test @@ -2,14 +2,34 @@ /** * @file - * Tests for tracker.module. + * Tests for the tracker module. */ +/** + * Sets up a base class for testing the tracker module. + */ class TrackerTest extends DrupalWebTestCase { + + /** + * The main user for testing. Info should be correctly tracked for this user. + * + * @var user + */ protected $user; + + /** + * A second user that will 'create' comments and nodes. + * + * @var user + */ protected $other_user; + + // @TODO this var doesn't seem to be used; should be removed? protected $new_node; + /** + * Return the name, description, and group info for this test case. + */ public static function getInfo() { return array( 'name' => 'Tracker', @@ -18,6 +38,11 @@ class TrackerTest extends DrupalWebTestCase { ); } + /** + * Set up the test class; initialize data needed for testing. + * + * @see DrupalWebTestCase::setUp() + */ function setUp() { parent::setUp('comment', 'tracker'); @@ -30,7 +55,7 @@ class TrackerTest extends DrupalWebTestCase { } /** - * Test the presence of nodes on the global tracker listing. + * Tests for the presence of nodes on the global tracker listing. */ function testTrackerAll() { $this->drupalLogin($this->user); @@ -45,18 +70,18 @@ class TrackerTest extends DrupalWebTestCase { )); $this->drupalGet('tracker'); - $this->assertNoText($unpublished->title, t('Unpublished node do not show up in the tracker listing.')); - $this->assertText($published->title, t('Published node show up in the tracker listing.')); + $this->assertNoText($unpublished->title, t('Unpublished node does not show up in the tracker listing.')); + $this->assertText($published->title, t('Published node shows up in the tracker listing.')); $this->assertLink(t('My recent content'), 0, t('User tab shows up on the global tracker page.')); // Delete a node and ensure it no longer appears on the tracker. node_delete($published->nid); $this->drupalGet('tracker'); - $this->assertNoText($published->title, t('Deleted node do not show up in the tracker listing.')); + $this->assertNoText($published->title, t('Deleted node does not show up in the tracker listing.')); } /** - * Test the presence of nodes on a user's tracker listing. + * Tests for the presence of nodes on a user's tracker listing. */ function testTrackerUser() { $this->drupalLogin($this->user); @@ -88,8 +113,8 @@ class TrackerTest extends DrupalWebTestCase { $this->drupalPost('comment/reply/' . $other_published_my_comment->nid, $comment, t('Save')); $this->drupalGet('user/' . $this->user->uid . '/track'); - $this->assertNoText($unpublished->title, t("Unpublished nodes do not show up in the users's tracker listing.")); - $this->assertText($my_published->title, t("Published nodes show up in the user's tracker listing.")); + $this->assertNoText($unpublished->title, t("Unpublished node does not show up in the users's tracker listing.")); + $this->assertText($my_published->title, t("Published node shows up in the user's tracker listing.")); $this->assertNoText($other_published_no_comment->title, t("Other user's nodes do not show up in the user's tracker listing.")); $this->assertText($other_published_my_comment->title, t("Nodes that the user has commented on appear in the user's tracker listing.")); @@ -102,7 +127,7 @@ class TrackerTest extends DrupalWebTestCase { } /** - * Test the presence of the "new" flag for nodes. + * Tests for the presence of the "new" flag for nodes. */ function testTrackerNewNodes() { $this->drupalLogin($this->user); @@ -130,7 +155,7 @@ class TrackerTest extends DrupalWebTestCase { } /** - * Test comment counters on the tracker listing. + * Tests for comment counters on the tracker listing. */ function testTrackerNewComments() { $this->drupalLogin($this->user); @@ -168,7 +193,7 @@ class TrackerTest extends DrupalWebTestCase { } /** - * Test that existing nodes are indexed by cron. + * Tests that existing nodes are indexed by cron. */ function testTrackerCronIndexing() { $this->drupalLogin($this->user); @@ -211,8 +236,8 @@ class TrackerTest extends DrupalWebTestCase { foreach ($nodes as $i => $node) { $this->assertText($node->title, t('Node @i is displayed on the tracker listing pages.', array('@i' => $i))); } - $this->assertText('1 new', t('New comment is counted on the tracker listing pages.')); - $this->assertText('updated', t('Node is listed as updated')); + $this->assertText('1 new', t('1 new comment is counted on the tracker listing pages.')); + $this->assertText('updated', t('A node is listed as updated')); // Fetch the site-wide tracker. @@ -222,11 +247,11 @@ class TrackerTest extends DrupalWebTestCase { foreach ($nodes as $i => $node) { $this->assertText($node->title, t('Node @i is displayed on the tracker listing pages.', array('@i' => $i))); } - $this->assertText('1 new', t('New comment is counted on the tracker listing pages.')); + $this->assertText('1 new', t('1 new comment is counted on the tracker listing pages.')); } /** - * Test that publish/unpublish works at admin/content/node + * Tests that publish/unpublish works at admin/content/node */ function testTrackerAdminUnpublish() { $admin_user = $this->drupalCreateUser(array('access content overview', 'administer nodes', 'bypass node access')); @@ -239,7 +264,7 @@ class TrackerTest extends DrupalWebTestCase { // Assert that the node is displayed. $this->drupalGet('tracker'); - $this->assertText($node->title, t('Node is displayed on the tracker listing pages.')); + $this->assertText($node->title, t('A node is displayed on the tracker listing pages.')); // Unpublish the node and ensure that it's no longer displayed. $edit = array( @@ -249,6 +274,6 @@ class TrackerTest extends DrupalWebTestCase { $this->drupalPost('admin/content', $edit, t('Update')); $this->drupalGet('tracker'); - $this->assertText(t('No content available.'), t('Node is displayed on the tracker listing pages.')); + $this->assertText(t('No content available.'), t('A node is displayed on the tracker listing pages.')); } }