Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
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

@adamlundrigan

SVN sync r24641 r24642

@akrabat akrabat merged commit 9765a23 into zendframework:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 25, 2012
  1. @adamlundrigan

    [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.
View
2  library/Zend/Feed/Writer/Deleted.php
@@ -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;
View
4 library/Zend/Feed/Writer/Entry.php
@@ -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;
View
13 tests/Zend/Feed/Writer/DeletedTest.php
@@ -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;
View
22 tests/Zend/Feed/Writer/EntryTest.php
@@ -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.