Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
ISSO - Blob - ViewGit - Blue Static
<?php

require_once 'PHPUnit/Framework.php';

/**
 * DateTest
 *
 * @author		Blue Static
 * @copyright	Copyright (c)2005 - 2009, Blue Static
 * @package		ISSO Tests
 *
 */
class DateTest extends PHPUnit_Framework_TestCase
{
	private $fixture;

	const DATE_FORMAT = 'Y-m-d H:i:s';

	public function setUp()
	{
		require_once ISSO . '/App.php';
		require_once ISSO . '/Date.php';
		$this->fixture = new BSDate();
	}

	public function testGmtTimes()
	{
		$this->fixture->setUserTimeZone(0);

		$this->assertEquals(gmdate(self::DATE_FORMAT, TIMENOW), $this->fixture->format(self::DATE_FORMAT, TIMENOW));
	}

	public function testGmtMinus8()
	{
		$this->fixture->setUserTimeZone(-8);
		$this->assertEquals('2007-04-01 00:00:00', $this->fixture->format(self::DATE_FORMAT, 1175414400));
	}

	public function testGmtNoAdjust()
	{
		$this->fixture->setUserTimeZone(4);
		$this->assertEquals(gmdate(self::DATE_FORMAT, TIMENOW), $this->fixture->format(self::DATE_FORMAT, TIMENOW, false));
	}

	public function testTimezoneList()
	{
		$this->assertEquals(sizeof(BSDate::fetch_timezone_list()), 30);
	}
}

?>