You are here

protected function FileLogRotationTest::setUp in File Log 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/FileLogRotationTest.php \Drupal\Tests\filelog\Unit\FileLogRotationTest::setUp()

Overrides FileLogTestBase::setUp

File

tests/src/Unit/FileLogRotationTest.php, line 59

Class

FileLogRotationTest
Tests the log rotation of the file logger.

Namespace

Drupal\Tests\filelog\Unit

Code

protected function setUp() : void {
  parent::setUp();

  // Force UTC time to avoid platform-specific effects.
  date_default_timezone_set('UTC');
  $this->fileManager = $this
    ->getMockBuilder(LogFileManager::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this->fileManager
    ->method('getFileName')
    ->willReturn('vfs://filelog/' . LogFileManager::FILENAME);
  $this->token = $this
    ->getMockBuilder(Token::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this->token
    ->method('replace')
    ->willReturnCallback([
    static::class,
    'tokenReplace',
  ]);
  $this->time = $this
    ->getMockBuilder(TimeInterface::class)
    ->getMock();
  $this->time
    ->method('getRequestTime')
    ->willReturn(86401);
}