You are here

protected function CronTest::rewindTime in Commerce Recurring Framework 8

Changes the current time.

Parameters

int $new_time: The new time.

Overrides RecurringKernelTestBase::rewindTime

5 calls to CronTest::rewindTime()
CronTest::testActive in tests/src/Kernel/CronTest.php
Tests handling active subscriptions and their orders.
CronTest::testCanceled in tests/src/Kernel/CronTest.php
Tests handling canceled subscriptions and their orders.
CronTest::testPending in tests/src/Kernel/CronTest.php
Tests activating pending subscriptions.
CronTest::testTrial in tests/src/Kernel/CronTest.php
Tests handling trial subscriptions and their orders.
CronTest::testTrialCanceled in tests/src/Kernel/CronTest.php
Tests handling canceled trial subscriptions and their orders.

File

tests/src/Kernel/CronTest.php, line 295

Class

CronTest
@coversDefaultClass \Drupal\commerce_recurring\Cron @group commerce_recurring

Namespace

Drupal\Tests\commerce_recurring\Kernel

Code

protected function rewindTime($new_time) {
  parent::rewindTime($new_time);

  // Reload the cron service so that it gets the updated service.
  $this->container
    ->set('commerce_recurring.cron', NULL);

  // Reload the queues so that their backends get the updated service.

  /** @var \Drupal\Core\Entity\EntityStorageInterface $queue_storage */
  $queue_storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('advancedqueue_queue');
  $queue_storage
    ->resetCache([
    'commerce_recurring',
  ]);
  $this->queue = $queue_storage
    ->load('commerce_recurring');
}