function TimestampFormatterWithTimeDiffTest::getRefreshIntervalTestCases

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffTest.php \Drupal\FunctionalJavascriptTests\Core\Field\TimestampFormatterWithTimeDiffTest::getRefreshIntervalTestCases()

Provides test cases for unit testing Drupal.timeDiff.refreshInterval().

Return value

array[] A list of test cases, each representing parameters to be passed to the javascript function.

1 call to TimestampFormatterWithTimeDiffTest::getRefreshIntervalTestCases()
TimestampFormatterWithTimeDiffTest::testTimestampFormatterWithTimeDiff in core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffTest.php
Tests the 'timestamp' formatter when is used with time difference setting.

File

core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffTest.php, line 270

Class

TimestampFormatterWithTimeDiffTest
Tests the 'timestamp' formatter when is used with time difference setting.

Namespace

Drupal\FunctionalJavascriptTests\Core\Field

Code

protected function getRefreshIntervalTestCases() : array {
  return [
    'passed timeout is not altered' => [
      'time_diff' => [
        'hour' => 11,
        'minute' => 10,
        'second' => 30,
      ],
      'configured_refresh_interval' => 10,
      'granularity' => 3,
      'computed_refresh_interval' => 10,
    ],
    'timeout lower than the lowest interval part' => [
      'time_diff' => [
        'hour' => 11,
        'minute' => 10,
      ],
      'configured_refresh_interval' => 59,
      'granularity' => 2,
      'computed_refresh_interval' => 60,
    ],
    'timeout with number of parts lower than the granularity' => [
      'time_diff' => [
        'hour' => 1,
        'minute' => 0,
      ],
      'configured_refresh_interval' => 10,
      'granularity' => 2,
      'computed_refresh_interval' => 60,
    ],
    'big refresh interval' => [
      'time_diff' => [
        'minute' => 3,
        'second' => 30,
      ],
      'configured_refresh_interval' => 1000,
      'granularity' => 1,
      'computed_refresh_interval' => 1000,
    ],
  ];
}

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