You are here

protected function RecurringKernelTestBase::rewindTime in Commerce Recurring Framework 8

Changes the current time.

Parameters

int $new_time: The new time.

3 calls to RecurringKernelTestBase::rewindTime()
CronTest::rewindTime in tests/src/Kernel/CronTest.php
Changes the current time.
RetryTest::rewindTime in tests/src/Kernel/Plugin/AdvancedQueue/JobType/RetryTest.php
Changes the current time.
SubscriptionLifecycleTest::testLifecycleWithTrial in tests/src/Kernel/SubscriptionLifecycleTest.php
Tests the subscription lifecycle, with a free trial.
2 methods override RecurringKernelTestBase::rewindTime()
CronTest::rewindTime in tests/src/Kernel/CronTest.php
Changes the current time.
RetryTest::rewindTime in tests/src/Kernel/Plugin/AdvancedQueue/JobType/RetryTest.php
Changes the current time.

File

tests/src/Kernel/RecurringKernelTestBase.php, line 204

Class

RecurringKernelTestBase
Provides a base class for Recurring kernel tests.

Namespace

Drupal\Tests\commerce_recurring\Kernel

Code

protected function rewindTime($new_time) {
  $mock_time = $this
    ->prophesize(TimeInterface::class);
  $mock_time
    ->getCurrentTime()
    ->willReturn($new_time);
  $mock_time
    ->getRequestTime()
    ->willReturn($new_time);
  $this->container
    ->set('datetime.time', $mock_time
    ->reveal());
}