Changeset 1900
- Timestamp:
- 10/24/08 15:02:24 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
framework/trunk/src/main/php/net/stubbles/xml/rss/stubRSSFeedItem.php
r1839 r1900 9 9 */ 10 10 stubClassLoader::load('net::stubbles::lang::exceptions::stubIllegalArgumentException', 11 'net::stubbles::lang::types::stubDate', 11 12 'net::stubbles::xml::stubXMLStreamWriter', 12 13 'net::stubbles::xml::rss::stubRSSFeedItemAnnotation' … … 297 298 * set the date when the item was published 298 299 * 299 * @param string|int $pubDate publishing date of rss feed item300 * @param string|int|stubDate $pubDate publishing date of rss feed item 300 301 * @return stubRSSFeedItem 301 302 * @throws stubIllegalArgumentException … … 303 304 public function publishedOn($pubDate) 304 305 { 305 if (is_int($pubDate) === false) { 306 if ($pubDate instanceof stubDate) { 307 $pubDate = $pubDate->getTimestamp(); 308 } elseif (is_int($pubDate) === false) { 306 309 $pubDate = strtotime($pubDate); 307 310 if (false === $pubDate) { 308 throw new stubIllegalArgumentException('Argument must be a unix timestamp or a valid string representation of a time.');311 throw new stubIllegalArgumentException('Argument must be a unix timestamp, a valid string representation of a time or an instance of net::stubbles::lang::types::stubDate.'); 309 312 } 310 313 } framework/trunk/src/test/php/net/stubbles/xml/rss/stubRSSFeedItemTestCase.php
r1763 r1900 6 6 * @package stubbles 7 7 * @subpackage xml_rss_test 8 * @version $Id$ 8 9 */ 9 10 stubClassLoader::load('net::stubbles::xml::rss::stubRSSFeedItem'); … … 147 148 * @test 148 149 */ 150 public function publishingDateAsInstance() 151 { 152 $date = new stubDate('2008-05-24'); 153 $this->assertSame($this->rssFeedItem1, $this->rssFeedItem1->publishedOn($date)); 154 $this->assertEquals('Sat 24 May 2008 00:00:00 +0200', $this->rssFeedItem1->getPubDate()); 155 } 156 157 /** 158 * alternate publishing date should be valid as well 159 * 160 * @test 161 */ 149 162 public function alternativePublishingDate() 150 163 {
