You are here

public function ScheduledTransitionSettingsFormTest::testAutomation in Scheduled Transitions 2.x

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

Tests automation/cron settings.

File

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

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');
}