Permalink
Browse files

[#5928] Added unit test

- Added unit test for patch; failed prior to applying patch, passes afterwards.
  • Loading branch information...
1 parent 1f93594 commit e7db151c13224d23a147337098c25497187f333a @weierophinney weierophinney committed Mar 7, 2014
Showing with 13 additions and 0 deletions.
  1. +13 −0 tests/ZendTest/Form/Element/DateTimeSelectTest.php
View
13 tests/ZendTest/Form/Element/DateTimeSelectTest.php
@@ -137,4 +137,17 @@ public function testCloningPreservesCorrectValues()
$this->assertEquals('04', $cloned->getMinuteElement()->getValue());
$this->assertEquals('05', $cloned->getSecondElement()->getValue());
}
+
+ public function testPassingNullValueToSetValueWillUseCurrentDate()
+ {
+ $now = new DateTime;
+ $element = new DateTimeSelectElement();
+ $element->setValue(null);
+ $yearElement = $element->getYearElement();
+ $monthElement = $element->getMonthElement();
+ $dayElement = $element->getDayElement();
+ $this->assertEquals($now->format('Y'), $yearElement->getValue());
+ $this->assertEquals($now->format('m'), $monthElement->getValue());
+ $this->assertEquals($now->format('d'), $dayElement->getValue());
+ }
}

0 comments on commit e7db151

Please sign in to comment.