function DateTimeNormalizerTest::setUp

Same name in other branches
  1. 9 core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\DateTimeNormalizerTest::setUp()
  2. 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\DateTimeNormalizerTest::setUp()
  3. 11.x 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 43

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);
}

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