public function TrackerTest::testTrackerAdminUnpublish in Drupal 9
Same name and namespace in other branches
- 8 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 429
Class
- TrackerTest
- Create and delete nodes and check for their display in the tracker listings.
Namespace
Drupal\Tests\tracker\FunctionalCode
public function testTrackerAdminUnpublish() {
\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.');
}