You are here

public function QueueMailConfigurationTest::testWaitTimePerItemValidation in Queue Mail 8

Tests "Wait time per item" setting validation.

File

tests/src/Functional/QueueMailConfigurationTest.php, line 87

Class

QueueMailConfigurationTest
Tests configuration of Queue mail module.

Namespace

Drupal\Tests\queue_mail\Functional

Code

public function testWaitTimePerItemValidation() {
  $this
    ->drupalLogin($this->adminUser);
  $validation_text = '"Wait time per item" value can not be bigger than "Queue processing time" value.';

  // "Wait time per item" value is bigger than "Queue processing time" value.
  $edit = [
    'queue_mail_queue_time' => 30,
    'queue_mail_queue_wait_time' => 35,
  ];
  $this
    ->drupalGet(static::CONFIGURATION_PATH);
  $this
    ->submitForm($edit, 'Save configuration');
  $this
    ->assertSession()
    ->responseContains($validation_text);

  // "Wait time per item" value is less than "Queue processing time" value.
  $edit = [
    'queue_mail_queue_time' => 30,
    'queue_mail_queue_wait_time' => 25,
  ];
  $this
    ->submitForm($edit, 'Save configuration');
  $this
    ->assertSession()
    ->responseNotContains($validation_text);
}