getRefreshIntervalTestCases example

$expected_value = json_encode($case['expected_value']);
      $expected_formatted_value = $case['expected_formatted_value'];

      // Test the returned value.       $this->assertJsCondition("JSON.stringify(Drupal.timeDiff.format($diff, $options).value) === '$expected_value'");
      // Test the returned formatted value.       $this->assertJsCondition("Drupal.timeDiff.format($diff, $options).formatted === '$expected_formatted_value'");
    }

    // Unit testing Drupal.timeDiff.refreshInterval(). Not using @dataProvider     // mechanism here in order to avoid reinstalling the site for each case.     foreach ($this->getRefreshIntervalTestCases() as $case) {
      $interval = json_encode($case['time_diff']);
      $this->assertJsCondition("Drupal.timeDiff.refreshInterval($interval, {$case['configured_refresh_interval']}, {$case['granularity']}) === {$case['computed_refresh_interval']}");
    }

    // Test the UI.     $time_element = $this->getSession()->getPage()->find('css', 'time');

    $time_diff = $time_element->getText();
    [$seconds_value] = explode(' ', $time_diff, 2);

    // Wait at least 1 second + 1 millisecond to make sure that the last time
Home | Imprint | This part of the site doesn't use cookies.