You are here

protected function DatabaseBackendTest::setUp in Advanced Queue 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/DatabaseBackendTest.php, line 42

Class

DatabaseBackendTest
@coversDefaultClass \Drupal\advancedqueue\Plugin\AdvancedQueue\Backend\Database @group advancedqueue

Namespace

Drupal\Tests\advancedqueue\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installSchema('advancedqueue', [
    'advancedqueue',
  ]);

  // Override the current time to control job timestamps.
  $mock_time = $this
    ->prophesize(TimeInterface::class);
  $mock_time
    ->getCurrentTime()
    ->willReturn(635814000);
  $this->container
    ->set('datetime.time', $mock_time
    ->reveal());
  $this->firstQueue = Queue::create([
    'id' => 'first_queue',
    'label' => 'First queue',
    'backend' => 'database',
    'backend_configuration' => [
      'lease_time' => 5,
    ],
  ]);
  $this->firstQueue
    ->save();
  $this->secondQueue = Queue::create([
    'id' => 'second_queue',
    'label' => 'Second queue',
    'backend' => 'database',
    'backend_configuration' => [
      'lease_time' => 5,
    ],
  ]);
  $this->secondQueue
    ->save();
}