You are here

public function DurationServiceTest::convertValueDataProvider in Duration Field 8

Data provider for testConvertValue.

File

tests/src/Unit/Service/DurationServiceTest.php, line 53

Class

DurationServiceTest
@coversDefaultClass \Drupal\duration_field\Service\DurationService @group duration_field

Namespace

Drupal\Tests\duration_field\Unit\Service

Code

public function convertValueDataProvider() {
  return [
    [
      [
        'year' => 1,
        'month' => 2,
        'day' => 3,
        'hour' => 4,
        'minute' => 5,
        'second' => 6,
      ],
      'P1Y2M3DT4H5M6S',
      'P1Y2M3DT4H5M6S was correctly validated',
    ],
    [
      [
        'year' => 1,
        'month' => 2,
        'day' => 3,
      ],
      'P1Y2M3D',
      '
        P1Y2M3D was correctly validated',
    ],
    [
      [
        'hour' => 4,
        'minute' => 5,
        'second' => 6,
      ],
      'PT4H5M6S',
      'PT4H5M6S was correctly validated',
    ],
    [
      [
        'year' => 1,
        'hour' => 4,
      ],
      'P1YT4H',
      'P1YT4H was correctly validated',
    ],
    [
      [],
      '',
      'empty string was correctly validated',
    ],
  ];
}