You are here

protected function NumberPatternKernelTestBase::rewindTime in Commerce Core 8.2

Changes the current time.

Parameters

int $new_time: The new time.

2 calls to NumberPatternKernelTestBase::rewindTime()
MonthlyTest::testGenerate in modules/number_pattern/tests/src/Kernel/Plugin/Commerce/NumberPattern/MonthlyTest.php
@covers ::generate
YearlyTest::testGenerate in modules/number_pattern/tests/src/Kernel/Plugin/Commerce/NumberPattern/YearlyTest.php
@covers ::generate

File

modules/number_pattern/tests/src/Kernel/NumberPatternKernelTestBase.php, line 51

Class

NumberPatternKernelTestBase
Provides a base class for number pattern kernel tests.

Namespace

Drupal\Tests\commerce_number_pattern\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());
}