public function SchedulerDeleteNodeTest::testDeleteNodeWithPastDates in Scheduler 8
Tests the deletion of a scheduled node.
Check that nodes can be deleted with no validation errors if the dates are in the past.
See also
http://drupal.org/node/2627370
File
- tests/
src/ Functional/ SchedulerDeleteNodeTest.php, line 67
Class
- SchedulerDeleteNodeTest
- Tests deletion of nodes enabled for Scheduler.
Namespace
Drupal\Tests\scheduler\FunctionalCode
public function testDeleteNodeWithPastDates() {
// Log in.
$this
->drupalLogin($this->adminUser);
// Create nodes with publish_on and unpublish_on dates in the past.
$published_node = $this
->drupalCreateNode([
'type' => $this->type,
'status' => TRUE,
'unpublish_on' => strtotime('- 2 day'),
]);
$unpublished_node = $this
->drupalCreateNode([
'type' => $this->type,
'status' => FALSE,
'publish_on' => strtotime('- 2 day'),
]);
// Attempt to delete the published node and check for no validation error.
$this
->drupalGet('node/' . $published_node
->id() . '/edit');
$this
->clickLink('Delete');
$this
->assertSession()
->pageTextNotContains('Error message');
$this
->assertSession()
->pageTextContains('Are you sure you want to delete the content');
// Attempt to delete the unpublished node and check for no validation error.
$this
->drupalGet('node/' . $unpublished_node
->id() . '/edit');
$this
->clickLink('Delete');
$this
->assertSession()
->pageTextNotContains('Error message');
$this
->assertSession()
->pageTextContains('Are you sure you want to delete the content');
}