function TrackerTest::testTrackerNewNodes

Tests for the presence of the "new" flag for nodes.

File

modules/tracker/tracker.test, line 121

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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.