Merge branch 'develop-ascraeus' into develop

* develop-ascraeus:
  [ticket/12367] Change phpbb_wrapper_gmgetdate_test to use data providers
This commit is contained in:
Nils Adermann 2014-04-10 14:25:08 -07:00
commit dea2cf508c

View file

@ -11,26 +11,28 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_wrapper_gmgetdate_test extends phpbb_test_case class phpbb_wrapper_gmgetdate_test extends phpbb_test_case
{ {
public function test_gmgetdate() public static function phpbb_gmgetdate_data()
{ {
$this->run_gmgetdate_assertion(); return array(
$this->run_test_with_timezone('UTC'); array(''),
$this->run_test_with_timezone('Europe/Berlin'); array('UTC'),
$this->run_test_with_timezone('America/Los_Angeles'); array('Europe/Berlin'),
$this->run_test_with_timezone('Antarctica/South_Pole'); array('America/Los_Angeles'),
array('Antarctica/South_Pole'),
);
} }
protected function run_test_with_timezone($timezone_identifier) /**
* @dataProvider phpbb_gmgetdate_data
*/
public function test_phpbb_gmgetdate($timezone_identifier)
{
if ($timezone_identifier)
{ {
$current_timezone = date_default_timezone_get(); $current_timezone = date_default_timezone_get();
date_default_timezone_set($timezone_identifier); date_default_timezone_set($timezone_identifier);
$this->run_gmgetdate_assertion();
date_default_timezone_set($current_timezone);
} }
protected function run_gmgetdate_assertion()
{
$expected = time(); $expected = time();
$date_array = phpbb_gmgetdate($expected); $date_array = phpbb_gmgetdate($expected);
@ -45,5 +47,10 @@ class phpbb_wrapper_gmgetdate_test extends phpbb_test_case
); );
$this->assertEquals($expected, $actual); $this->assertEquals($expected, $actual);
if (isset($current_timezone))
{
date_default_timezone_set($current_timezone);
}
} }
} }