function TrackerTest::testTrackerNewNodes in Drupal 7
Tests for the presence of the "new" flag for nodes.
File
- modules/
tracker/ tracker.test, line 121 - Tests for tracker.module.
Class
- TrackerTest
- Defines a base class for testing tracker.module.
Code
function testTrackerNewNodes() {
$this
->drupalLogin($this->user);
$edit = array(
'title' => $this
->randomName(8),
);
$node = $this
->drupalCreateNode($edit);
$title = $edit['title'];
$this
->drupalGet('tracker');
$this
->assertPattern('/' . $title . '.*new/', 'New nodes are flagged as such in the tracker listing.');
$this
->drupalGet('node/' . $node->nid);
$this
->drupalGet('tracker');
$this
->assertNoPattern('/' . $title . '.*new/', 'Visited nodes are not flagged as new.');
$this
->drupalLogin($this->other_user);
$this
->drupalGet('tracker');
$this
->assertPattern('/' . $title . '.*new/', 'For another user, new nodes are flagged as such in the tracker listing.');
$this
->drupalGet('node/' . $node->nid);
$this
->drupalGet('tracker');
$this
->assertNoPattern('/' . $title . '.*new/', 'For another user, visited nodes are not flagged as new.');
}