function TrackerTest::testTrackerAll

Same name in other branches
  1. 9 core/modules/tracker/tests/src/Functional/TrackerTest.php \Drupal\Tests\tracker\Functional\TrackerTest::testTrackerAll()
  2. 8.9.x core/modules/tracker/tests/src/Functional/TrackerTest.php \Drupal\Tests\tracker\Functional\TrackerTest::testTrackerAll()
  3. 10 core/modules/tracker/tests/src/Functional/TrackerTest.php \Drupal\Tests\tracker\Functional\TrackerTest::testTrackerAll()
  4. 11.x core/modules/tracker/tests/src/Functional/TrackerTest.php \Drupal\Tests\tracker\Functional\TrackerTest::testTrackerAll()

Tests for the presence of nodes on the global tracker listing.

File

modules/tracker/tracker.test, line 49

Class

TrackerTest
Defines a base class for testing tracker.module.

Code

function testTrackerAll() {
    $this->drupalLogin($this->user);
    $unpublished = $this->drupalCreateNode(array(
        'title' => $this->randomName(8),
        'status' => 0,
    ));
    $published = $this->drupalCreateNode(array(
        'title' => $this->randomName(8),
        'status' => 1,
    ));
    $this->drupalGet('tracker');
    $this->assertNoText($unpublished->title, 'Unpublished node do not show up in the tracker listing.');
    $this->assertText($published->title, 'Published node show up in the tracker listing.');
    $this->assertLink(t('My recent content'), 0, '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, 'Deleted node do not show up in the tracker listing.');
}

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