You are here

protected function DateTimeNormalizerTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\DateTimeNormalizerTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php, line 41

Class

DateTimeNormalizerTest
Unit test coverage for @DataTypes implementing DateTimeInterface.

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

protected function setUp() : void {
  parent::setUp();
  $system_date_config = $this
    ->prophesize(ImmutableConfig::class);
  $system_date_config
    ->get('timezone.default')
    ->willReturn('Australia/Sydney');
  $config_factory = $this
    ->prophesize(ConfigFactoryInterface::class);
  $config_factory
    ->get('system.date')
    ->willReturn($system_date_config
    ->reveal());
  $this->normalizer = new DateTimeNormalizer($config_factory
    ->reveal());
  $this->data = $this
    ->prophesize(DateTimeInterface::class);
}