| 7 tracker.test | TrackerTest::testTrackerUser() |
| 8 TrackerTest.php | TrackerTest::testTrackerUser() |
Tests for the presence of nodes on a user's tracker listing.
File
- modules/
tracker/ tracker.test, line 75 - Tests for tracker.module.
Code
function testTrackerUser() {
$this->drupalLogin($this->user);
$unpublished = $this->drupalCreateNode(array(
'title' => $this->randomName(8),
'uid' => $this->user->uid,
'status' => 0,
));
$my_published = $this->drupalCreateNode(array(
'title' => $this->randomName(8),
'uid' => $this->user->uid,
'status' => 1,
));
$other_published_no_comment = $this->drupalCreateNode(array(
'title' => $this->randomName(8),
'uid' => $this->other_user->uid,
'status' => 1,
));
$other_published_my_comment = $this->drupalCreateNode(array(
'title' => $this->randomName(8),
'uid' => $this->other_user->uid,
'status' => 1,
));
$comment = array(
'subject' => $this->randomName(),
'comment_body[' . LANGUAGE_NONE . '][0][value]' => $this->randomName(20),
);
$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($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."));
// Verify that unpublished comments are removed from the tracker.
$admin_user = $this->drupalCreateUser(array('administer comments', 'access user profiles'));
$this->drupalLogin($admin_user);
$this->drupalPost('comment/1/edit', array('status' => COMMENT_NOT_PUBLISHED), t('Save'));
$this->drupalGet('user/' . $this->user->uid . '/track');
$this->assertNoText($other_published_my_comment->title, 'Unpublished comments are not counted on the tracker listing.');
}
Login or register to post comments