mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/12367] Change phpbb_wrapper_gmgetdate_test to use data providers
PHPBB3-12367
This commit is contained in:
parent
f0176b5393
commit
2721b16cc3
1 changed files with 22 additions and 15 deletions
|
@ -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)
|
||||||
{
|
{
|
||||||
$current_timezone = date_default_timezone_get();
|
if ($timezone_identifier)
|
||||||
|
{
|
||||||
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue