You are here

protected function RetryTest::rewindTime in Commerce Recurring Framework 8

Changes the current time.

Parameters

int $new_time: The new time.

Overrides RecurringKernelTestBase::rewindTime

2 calls to RetryTest::rewindTime()
RetryTest::testFailure in tests/src/Kernel/Plugin/AdvancedQueue/JobType/RetryTest.php
@covers ::process @covers ::handleDecline @covers ::updateSubscriptions
RetryTest::testRetry in tests/src/Kernel/Plugin/AdvancedQueue/JobType/RetryTest.php
@covers ::process @covers ::handleDecline @covers ::updateSubscriptions

File

tests/src/Kernel/Plugin/AdvancedQueue/JobType/RetryTest.php, line 236

Class

RetryTest
@coversDefaultClass \Drupal\commerce_recurring\Plugin\AdvancedQueue\JobType\RecurringJobTypeBase @group commerce_recurring

Namespace

Drupal\Tests\commerce_recurring\Kernel\Plugin\AdvancedQueue\JobType

Code

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

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

  // Reset services so that new time gets injected.
  $this->container
    ->set('commerce_recurring.payment_declined_mail', NULL);
  $this->container
    ->set('commerce_recurring.event_subscriber.dunning_subscriber', NULL);
  $this->container
    ->set('event_dispatcher', NULL);
}