public function TrackerTest::testTrackerAdminUnpublish in Drupal 8
Same name and namespace in other branches
- 9 core/modules/tracker/tests/src/Functional/TrackerTest.php \Drupal\Tests\tracker\Functional\TrackerTest::testTrackerAdminUnpublish()
- 10 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 424
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',
]);
\Drupal::service('router.builder')
->rebuild();
$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
->assertText($node
->label(), 'A node is displayed on the tracker listing pages.');
// Unpublish the node and ensure that it's no longer displayed.
$edit = [
'action' => 'node_unpublish_action',
'node_bulk_form[0]' => $node
->id(),
];
$this
->drupalPostForm('admin/content', $edit, t('Apply to selected items'));
$this
->drupalGet('activity');
$this
->assertText(t('No content available.'), 'A node is displayed on the tracker listing pages.');
}