function TrackerTest::testTrackerAdminUnpublish
Same name in other branches
- 7.x modules/tracker/tracker.test \TrackerTest::testTrackerAdminUnpublish()
- 9 core/modules/tracker/tests/src/Functional/TrackerTest.php \Drupal\Tests\tracker\Functional\TrackerTest::testTrackerAdminUnpublish()
- 8.9.x core/modules/tracker/tests/src/Functional/TrackerTest.php \Drupal\Tests\tracker\Functional\TrackerTest::testTrackerAdminUnpublish()
- 11.x core/modules/tracker/tests/src/Functional/TrackerTest.php \Drupal\Tests\tracker\Functional\TrackerTest::testTrackerAdminUnpublish()
Tests that publish/unpublish works at admin/content/node.
File
-
core/
modules/ tracker/ tests/ src/ Functional/ TrackerTest.php, line 426
Class
- TrackerTest
- Create and delete nodes and check for their display in the tracker listings.
Namespace
Drupal\Tests\tracker\FunctionalCode
public function testTrackerAdminUnpublish() : void {
\Drupal::service('module_installer')->install([
'views',
]);
$admin_user = $this->drupalCreateUser([
'access content overview',
'administer nodes',
'bypass node access',
]);
$this->drupalLogin($admin_user);
$node = $this->drupalCreateNode([
'title' => $this->randomMachineName(),
]);
// Assert that the node is displayed.
$this->drupalGet('activity');
$this->assertSession()
->pageTextContains($node->label());
// Unpublish the node and ensure that it's no longer displayed.
$edit = [
'action' => 'node_unpublish_action',
'node_bulk_form[0]' => $node->id(),
];
$this->drupalGet('admin/content');
$this->submitForm($edit, 'Apply to selected items');
$this->drupalGet('activity');
$this->assertSession()
->pageTextContains('No content available.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.