Changeset 1860
- Timestamp:
- 09/27/08 01:42:51 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
framework/trunk/src/main/php/net/stubbles/lang/types/stubDate.php
r1858 r1860 62 62 } 63 63 } elseif (is_string($dateTime) === true) { 64 if (null === $timeZone) { 65 $this->dateTime = date_create($dateTime); 66 } else { 67 $this->dateTime = date_create($dateTime, $timeZone->getHandle()); 64 try { 65 if (null === $timeZone) { 66 $this->dateTime = new DateTime($dateTime); 67 } else { 68 $this->dateTime = new DateTime($dateTime, $timeZone->getHandle()); 69 } 70 } catch (Exception $e) { 71 throw new stubIllegalArgumentException('Given datetime string ' . $dateTime . ' is not a valid date string.'); 68 72 } 69 73 } else { framework/trunk/src/test/php/net/stubbles/lang/types/stubDateTestCase.php
r1858 r1860 413 413 $date = new stubDate(null); 414 414 } 415 416 /** 417 * failing constructoon throws a illegal argument exception 418 * 419 * @test 420 * @expectedException stubIllegalArgumentException 421 */ 422 public function invalidDateStringhrowsIllegalArgumentException() 423 { 424 $date = new stubDate('invalid'); 425 } 415 426 } 416 427 ?>
