You are here

protected function SchedulerApiTest::approveNode in Scheduler 8

Approves a node for publication or unpublication.

Parameters

int $nid: The id of the node to approve.

string $field_name: The name of the field to set, either 'field_approved_publishing' or 'field_approved_unpublishing'.

2 calls to SchedulerApiTest::approveNode()
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 196

Class

SchedulerApiTest
Tests the API of the Scheduler module.

Namespace

Drupal\Tests\scheduler\Functional

Code

protected function approveNode($nid, $field_name) {
  $this->nodeStorage
    ->resetCache([
    $nid,
  ]);
  $node = $this->nodeStorage
    ->load($nid);
  $node
    ->set($field_name, TRUE)
    ->save();
}