/** * Testing getOffsetFromGMT * * @param mixed $tz Which time zone? (can be string or numeric * @param string $setTime What time should be set? * @param boolean $hours Return offset in hours (true) or seconds? * @param string $expected What should the resulting time string look like? * * @return void * * @dataProvider casesGetOffsetFromGmt * @since 11.3 * @covers JDate::getOffsetFromGMT */ public function testGetOffsetFromGmt($tz, $setTime, $hours, $expected) { if (is_null($tz)) { $testJDate = new JDate($setTime); } else { $testJDate = new JDate($setTime, $tz); } if (is_null($hours)) { $offset = $testJDate->getOffsetFromGmt(); } else { $offset = $testJDate->getOffsetFromGmt($hours); } $this->assertThat($offset, $this->equalTo($expected)); }
/** * Testing getOffsetFromGMT * * @param mixed $tz Which time zone? (can be string or numeric * @param string $setTime What time should be set? * @param boolean $hours Return offset in hours (true) or seconds? * @param string $expected What should the resulting time string look like? * * @return void * * @dataProvider casesGetOffsetFromGmt * @since 11.3 * @covers JDate::getOffsetFromGMT */ public function testGetOffsetFromGmt($tz, $setTime, $hours, $expected) { $testJDate = new JDate($setTime, $tz); $offset = $testJDate->getOffsetFromGmt($hours); $this->assertEquals($expected, $offset); }