function TrackerTest::testTrackerAdminUnpublish in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/tracker/src/Tests/TrackerTest.php \Drupal\tracker\Tests\TrackerTest::testTrackerAdminUnpublish()
Tests that publish/unpublish works at admin/content/node.
File
- core/
modules/ tracker/ src/ Tests/ TrackerTest.php, line 401 - Contains \Drupal\tracker\Tests\TrackerTest.
Class
- TrackerTest
- Create and delete nodes and check for their display in the tracker listings.
Namespace
Drupal\tracker\TestsCode
function testTrackerAdminUnpublish() {
\Drupal::service('module_installer')
->install(array(
'views',
));
\Drupal::service('router.builder')
->rebuild();
$admin_user = $this
->drupalCreateUser(array(
'access content overview',
'administer nodes',
'bypass node access',
));
$this
->drupalLogin($admin_user);
$node = $this
->drupalCreateNode(array(
'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 = array(
'action' => 'node_unpublish_action',
'node_bulk_form[0]' => $node
->id(),
);
$this
->drupalPostForm('admin/content', $edit, t('Apply'));
$this
->drupalGet('activity');
$this
->assertText(t('No content available.'), 'A node is displayed on the tracker listing pages.');
}