function TimestampNormalizerTest::jsonSchemaDataProvider

Overrides JsonSchemaTestTrait::jsonSchemaDataProvider

File

core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php, line 141

Class

TimestampNormalizerTest
Unit test coverage for the "Timestamp" @DataType.

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public static function jsonSchemaDataProvider() : array {
    $case = function (UnitTestCase $test) {
        assert(in_array(JsonSchemaTestTrait::class, class_uses($test)));
        $drupal_date_time = $test->doProphesize(TimestampNormalizerTestDrupalDateTime::class);
        $drupal_date_time->setTimezone(new \DateTimeZone('UTC'))
            ->willReturn($drupal_date_time->reveal());
        $drupal_date_time->format(\DateTime::RFC3339)
            ->willReturn('1983-07-12T09:05:00-05:00');
        $data = $test->doProphesize(Timestamp::class);
        $data->getDateTime()
            ->willReturn($drupal_date_time->reveal());
        return $data->reveal();
    };
    return [
        'RFC 3339' => [
            fn(UnitTestCase $test) => $case($test),
        ],
    ];
}

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