/**
  * This converts to a qCal_Date for internal storage
  */
 protected function doCast($value)
 {
     $date = qCal_Time::factory($value);
     return $date;
 }
 /**
  * Time can be generated from string by using the factory method
  */
 public function testFactoryMethod()
 {
     // test with default timezone
     $time = qCal_Time::factory("1:30pm");
     // should default to America/Los_Angeles
     $this->assertEqual($time->getHour(), 13);
     $this->assertEqual($time->getMinute(), 30);
     $this->assertEqual($time->getSecond(), 0);
     $this->assertEqual($time->getTimezone()->getName(), date_default_timezone_get());
     // test with specific timezone
     $time = qCal_Time::factory("1:30pm", "MST");
     // GMT - 7 hours
     $this->assertEqual($time->getHour(), 13);
     // timezone doesn't change the time
     $this->assertEqual($time->getMinute(), 30);
     $this->assertEqual($time->getSecond(), 0);
     $this->assertEqual($time->getTimezone()->getName(), "MST");
 }
 public function testTimeFactory()
 {
     $time1 = qCal_Time::factory("4:00");
     // will result in 4:00am using the server's timezone
     $this->assertEqual($time1->__toString(), "04:00:00");
     $time2 = qCal_Time::factory("tomorrow", "GMT");
     // will result in whatever tomorrow's date is in GMT
     $time3 = qCal_Time::factory("now", "America/Los_Angeles");
     // will result in the current time in America/Los_Angeles
 }