Happy new year!
[isso.git] / UnitTest / DateTest.php
1 <?php
2
3 require_once 'PHPUnit/Framework.php';
4
5 /**
6 * DateTest
7 *
8 * @author Blue Static
9 * @copyright Copyright (c)2005 - 2009, Blue Static
10 * @package ISSO Tests
11 *
12 */
13 class DateTest extends PHPUnit_Framework_TestCase
14 {
15 private $fixture;
16
17 const DATE_FORMAT = 'Y-m-d H:i:s';
18
19 public function setUp()
20 {
21 require_once ISSO . '/App.php';
22 require_once ISSO . '/Date.php';
23 $this->fixture = new BSDate();
24 }
25
26 public function testGmtTimes()
27 {
28 $this->fixture->setUserTimeZone(0);
29
30 $this->assertEquals(gmdate(self::DATE_FORMAT, TIMENOW), $this->fixture->format(self::DATE_FORMAT, TIMENOW));
31 }
32
33 public function testGmtMinus8()
34 {
35 $this->fixture->setUserTimeZone(-8);
36 $this->assertEquals('2007-04-01 00:00:00', $this->fixture->format(self::DATE_FORMAT, 1175414400));
37 }
38
39 public function testGmtNoAdjust()
40 {
41 $this->fixture->setUserTimeZone(4);
42 $this->assertEquals(gmdate(self::DATE_FORMAT, TIMENOW), $this->fixture->format(self::DATE_FORMAT, TIMENOW, false));
43 }
44
45 public function testTimezoneList()
46 {
47 $this->assertEquals(sizeof(BSDate::fetch_timezone_list()), 30);
48 }
49 }
50
51 ?>