Translation update done using Pootle.
[phpmyadmin/ammaryasirr.git] / test / libraries / common / PMA_localisedDateTimespan_test.php
blob92f980cc87fcf0fa3ab5aff9c91daa78d2754a39
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for generating localised date or timespan expression
6 * @package phpMyAdmin-test
7 * @version $Id: PMA_localisedDateTimespan_test.php
8 * @group common.lib-tests
9 */
12 * Include to test.
14 require_once 'libraries/common.lib.php';
16 class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
18 /**
19 * temporary variable for globals array
21 protected $tmpGlobals;
23 /**
24 * temporary variable for session array
26 protected $tmpSession;
28 /**
29 * temporary variable for timezone info
31 protected $tmpTimezone;
33 /**
34 * storing globals and session
36 public function setUp() {
38 $this->tmpGlobals = $GLOBALS;
39 $this->tmpSession = $_SESSION;
40 $this->tmpTimezone = date_default_timezone_get();
41 date_default_timezone_set('Europe/London');
44 /**
45 * recovering globals and session
47 public function tearDown() {
49 $GLOBALS = $this->tmpGlobals;
50 $_SESSION = $this->tmpSession;
51 date_default_timezone_set($this->tmpTimezone);
55 /**
56 * data provider for localised date test
58 public function localisedDateDataProvider() {
59 return array(
60 array(1227455558, '', 'Nov 23, 2008 at 03:52 PM'),
61 array(1227455558, '%Y-%m-%d %H:%M:%S %a', '2008-11-23 15:52:38 Sun')
65 /**
66 * localised date test, globals are defined
67 * @dataProvider localisedDateDataProvider
69 public function testLocalisedDate($a, $b, $e) {
70 $this->assertEquals($e, PMA_localisedDate($a, $b));
73 /**
74 * data provider for localised timestamp test
77 public function timespanFormatDataProvider() {
78 return array(
79 array(1258, '0 days, 0 hours, 20 minutes and 58 seconds'),
80 array(821958, '9 days, 12 hours, 19 minutes and 18 seconds')
84 /**
85 * localised timestamp test, globals are defined
86 * @dataProvider timespanFormatDataProvider
88 public function testTimespanFormat($a, $e) {
89 $GLOBALS['timespanfmt'] = '%s days, %s hours, %s minutes and %s seconds';
91 $this->assertEquals($e, PMA_timespanFormat($a));