You are here

public function GranularityServiceTest::convertGranularityArrayToGranularityStringDataProvider in Duration Field 8.2

Same name and namespace in other branches
  1. 3.0.x tests/src/Unit/Service/GranularityServiceTest.php \Drupal\Tests\duration_field\Unit\Service\GranularityServiceTest::convertGranularityArrayToGranularityStringDataProvider()

Data provider for testconvertGranularityArrayToGranularityString().

File

tests/src/Unit/Service/GranularityServiceTest.php, line 26

Class

GranularityServiceTest
@coversDefaultClass \Drupal\duration_field\Service\GranularityService @group duration_field

Namespace

Drupal\Tests\duration_field\Unit\Service

Code

public function convertGranularityArrayToGranularityStringDataProvider() {
  return [
    [
      [
        'y' => TRUE,
        'm' => TRUE,
        'd' => TRUE,
        'h' => TRUE,
        'i' => TRUE,
        's' => TRUE,
      ],
      'y:m:d:h:i:s',
      'A full granularity array was converted to a granularity string',
    ],
    [
      [
        'y' => TRUE,
        'm' => FALSE,
        'd' => TRUE,
        'h' => FALSE,
        'i' => TRUE,
        's' => FALSE,
      ],
      'y:d:i',
      'A granularity array was correctly converted to the granularity string y:d:i',
    ],
    [
      [
        'y' => FALSE,
        'm' => FALSE,
        'd' => FALSE,
        'h' => FALSE,
        'i' => FALSE,
        's' => FALSE,
      ],
      '',
      'An empty granularity array was correctly converted to an empty granularity string',
    ],
  ];
}