You are here

public function QueueTest::testQueueEditing in Advanced Queue 8

Tests editing a queue.

File

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

Class

QueueTest
Tests the queue UI.

Namespace

Drupal\Tests\advancedqueue\Functional

Code

public function testQueueEditing() {
  $queue = Queue::create([
    'id' => 'test',
    'label' => 'Test',
    'backend' => 'database',
    'processor' => QueueInterface::PROCESSOR_DAEMON,
    'processing_time' => 100,
  ]);
  $queue
    ->save();
  $this
    ->drupalGet('admin/config/system/queues/manage/' . $queue
    ->id());
  $this
    ->submitForm([
    'label' => 'Test (Modified)',
    'configuration[database][lease_time]' => '202',
    'processor' => QueueInterface::PROCESSOR_CRON,
    'processing_time' => '120',
  ], 'Save');
  \Drupal::entityTypeManager()
    ->getStorage('advancedqueue_queue')
    ->resetCache();
  $queue = Queue::load('test');
  $this
    ->assertEquals('test', $queue
    ->id());
  $this
    ->assertEquals('Test (Modified)', $queue
    ->label());
  $this
    ->assertEquals('database', $queue
    ->getBackendId());
  $this
    ->assertEquals([
    'lease_time' => 202,
  ], $queue
    ->getBackendConfiguration());
  $this
    ->assertEquals($queue
    ->getBackendConfiguration(), $queue
    ->getBackend()
    ->getConfiguration());
  $this
    ->assertEquals(QueueInterface::PROCESSOR_CRON, $queue
    ->getProcessor());
  $this
    ->assertEquals(120, $queue
    ->getProcessingTime());
  $this
    ->assertFalse($queue
    ->isLocked());
}