You are here

protected function SchedulerApiTest::createUnapprovedNode in Scheduler 8

Creates a new node that is not approved.

The node has a publish/unpublish date in the past to make sure it will be included in the next cron run.

Parameters

string $date_field: The Scheduler date field to set, either 'publish_on' or 'unpublish_on'.

Return value

\Drupal\node\NodeInterface A node object.

2 calls to SchedulerApiTest::createUnapprovedNode()
SchedulerApiTest::testAllowedPublishing in tests/src/Functional/SchedulerApiTest.php
Covers hook_scheduler_allow_publishing()
SchedulerApiTest::testAllowedUnpublishing in tests/src/Functional/SchedulerApiTest.php
Covers hook_scheduler_allow_unpublishing()

File

tests/src/Functional/SchedulerApiTest.php, line 176

Class

SchedulerApiTest
Tests the API of the Scheduler module.

Namespace

Drupal\Tests\scheduler\Functional

Code

protected function createUnapprovedNode($date_field) {
  $settings = [
    'status' => $date_field == 'unpublish_on',
    $date_field => strtotime('-1 day'),
    'field_approved_publishing' => 0,
    'field_approved_unpublishing' => 0,
    'type' => $this->customName,
  ];
  return $this
    ->drupalCreateNode($settings);
}