function TwigExtensionTest::setUpMockDateFormatter

Reinitializes the date formatter as a mock object.

1 call to TwigExtensionTest::setUpMockDateFormatter()
TwigExtensionTest::testFormatDate in core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
Tests the format_date filter.

File

core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php, line 102

Class

TwigExtensionTest
Tests the twig extension.

Namespace

Drupal\Tests\Core\Template

Code

protected function setUpMockDateFormatter() : void {
  $this->dateFormatter = $this->createMock(DateFormatterInterface::class);
  $reflection = new \ReflectionProperty($this->systemUnderTest, 'dateFormatter');
  $reflection->setValue($this->systemUnderTest, $this->dateFormatter);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.