Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[ZF-12070] Fix remaining classes in Zend\Feed\Writer to accept UNIX timestamps which are <>10 digits #841

Merged
merged 1 commit into from

2 participants

Adam Lundrigan Rob Allen
Adam Lundrigan

SVN sync r24641 r24642

Rob Allen akrabat merged commit 9765a23 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 25, 2012
  1. Adam Lundrigan

    [ZF-12070] Fix remaining classes in Zend\Feed\Writer to accept UNIX t…

    adamlundrigan authored
    …imestamps which are <>10 digits
This page is out of date. Refresh to see the latest.
2  library/Zend/Feed/Writer/Deleted.php
View
@@ -131,7 +131,7 @@ public function setWhen($date = null)
$zdate = null;
if ($date === null) {
$zdate = new Date\Date;
- } elseif (ctype_digit($date) && strlen($date) == 10) {
+ } elseif (ctype_digit($date)) {
$zdate = new Date\Date($date, Date\Date::TIMESTAMP);
} elseif ($date instanceof Date\Date) {
$zdate = $date;
4 library/Zend/Feed/Writer/Entry.php
View
@@ -197,7 +197,7 @@ public function setDateCreated($date = null)
$zdate = null;
if ($date === null) {
$zdate = new Date\Date;
- } elseif (ctype_digit($date) && strlen($date) == 10) {
+ } elseif (ctype_digit($date)) {
$zdate = new Date\Date($date, Date\Date::TIMESTAMP);
} elseif ($date instanceof Date\Date) {
$zdate = $date;
@@ -217,7 +217,7 @@ public function setDateModified($date = null)
$zdate = null;
if ($date === null) {
$zdate = new Date\Date;
- } elseif (ctype_digit($date) && strlen($date) == 10) {
+ } elseif (ctype_digit($date)) {
$zdate = new Date\Date($date, Date\Date::TIMESTAMP);
} elseif ($date instanceof Date\Date) {
$zdate = $date;
13 tests/Zend/Feed/Writer/DeletedTest.php
View
@@ -76,7 +76,18 @@ public function testSetWhenUsesGivenUnixTimestamp()
$myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP);
$this->assertTrue($myDate->equals($entry->getWhen()));
}
-
+
+ /**
+ * @group ZF-12070
+ */
+ public function testSetWhenUsesGivenUnixTimestampWhenItIsLessThanTenDigits()
+ {
+ $entry = new Writer\Deleted;
+ $entry->setWhen(123456789);
+ $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP);
+ $this->assertTrue($myDate->equals($entry->getWhen()));
+ }
+
public function testSetWhenUsesZendDateObject()
{
$entry = new Writer\Deleted;
22 tests/Zend/Feed/Writer/EntryTest.php
View
@@ -266,6 +266,17 @@ public function testSetDateCreatedUsesGivenUnixTimestamp()
$this->assertTrue($myDate->equals($entry->getDateCreated()));
}
+ /**
+ * @group ZF-12070
+ */
+ public function testSetDateCreatedUsesGivenUnixTimestampWhenItIsLessThanTenDigits()
+ {
+ $entry = new Writer\Entry;
+ $entry->setDateCreated(123456789);
+ $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP);
+ $this->assertTrue($myDate->equals($entry->getDateCreated()));
+ }
+
public function testSetDateCreatedUsesZendDateObject()
{
$entry = new Writer\Entry;
@@ -290,6 +301,17 @@ public function testSetDateModifiedUsesGivenUnixTimestamp()
$this->assertTrue($myDate->equals($entry->getDateModified()));
}
+ /**
+ * @group ZF-12070
+ */
+ public function testSetDateModifiedUsesGivenUnixTimestampWhenItIsLessThanTenDigits()
+ {
+ $entry = new Writer\Entry;
+ $entry->setDateModified(123456789);
+ $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP);
+ $this->assertTrue($myDate->equals($entry->getDateModified()));
+ }
+
public function testSetDateModifiedUsesZendDateObject()
{
$entry = new Writer\Entry;
Something went wrong with that request. Please try again.