You are here

protected function SchedulerHooksLegacyTest::setUp in Scheduler 2.x

Overrides SchedulerBrowserTestBase::setUp

File

tests/src/Functional/SchedulerHooksLegacyTest.php, line 32

Class

SchedulerHooksLegacyTest
Tests the legacy API hook functions of the Scheduler module.

Namespace

Drupal\Tests\scheduler\Functional

Code

protected function setUp() : void {
  parent::setUp();

  // Load the custom node type. It will be enabled for Scheduler automatically
  // as that is pre-configured in node.type.scheduler_api_test.yml.
  $this->customName = 'scheduler_api_node_test';
  $this->customNodetype = NodeType::load($this->customName);

  // Check that the custom node type has loaded OK.
  $this
    ->assertNotNull($this->customNodetype, 'Custom node type "' . $this->customName . '" was created during install');

  // Create a web user that has permission to create and edit and schedule
  // the custom entity type.
  $this->webUser = $this
    ->drupalCreateUser([
    'create ' . $this->customName . ' content',
    'edit any ' . $this->customName . ' content',
    'schedule publishing of nodes',
  ]);
  $this->webUser
    ->set('name', 'Wenlock the Web user')
    ->save();
}