assertEquals($expected, $result); } /** * Data provider for the testIntervalToTime method * @return array[] the parameters */ public function intervalToTimeProvider() { return [ [new DateInterval('PT0H0M0S'), '00:00:00'], [new DateInterval('PT1H34M28S'), '01:34:28'], [new DateIntervalMS('PT1H34M28.012345S'), '01:34:28.012345'], ]; } /** * Test {@link tao_helpers_Duration::intervalToTime} * @dataProvider intervalToTimeProvider * @param string $time the parameter of intervalToTime * @param string $expected the expected result */ public function testIntervalToTime($interval, $expected) { $result = tao_helpers_Duration::intervalToTime($interval); $this->assertEquals($expected, $result); } /** * Data provider for the testDurationToTime method * @return array[] the parameters */ public function durationToTimeProvider() { return [ ['PT0H0M0S', '00:00:00'], ['PT1H34M28S', '01:34:28'], ['PT1H34M28.012345S', '01:34:28.012345'], ['', null], [null, null] ]; } /** * Test {@link tao_helpers_Duration::durationToTime} * @dataProvider durationToTimeProvider * @param string $duration the parameter of durationToTime * @param string $expected the expected result */ public function testDurationToTime($duration, $expected) { $result = tao_helpers_Duration::durationToTime($duration); $this->assertEquals($expected, $result); } }