You are here

public function ScheduledTransitionSettingsFormTest::testAutomation in Scheduled Transitions 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/ScheduledTransitionSettingsFormTest.php \Drupal\Tests\scheduled_transitions\Functional\ScheduledTransitionSettingsFormTest::testAutomation()

Tests automation/cron settings.

File

tests/src/Functional/ScheduledTransitionSettingsFormTest.php, line 41

Class

ScheduledTransitionSettingsFormTest
Tests settings form.

Namespace

Drupal\Tests\scheduled_transitions\Functional

Code

public function testAutomation() : void {
  $currentUser = $this
    ->drupalCreateUser([
    'administer scheduled transitions',
  ]);
  $this
    ->drupalLogin($currentUser);
  $url = Url::fromRoute('scheduled_transitions.settings');
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->checkboxChecked('cron_create_queue_items');
  $edit = [
    'cron_create_queue_items' => FALSE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save configuration');
  $this
    ->assertSession()
    ->pageTextContains('The configuration options have been saved.');
  $this
    ->assertSession()
    ->checkboxNotChecked('cron_create_queue_items');
}