File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
lib/Cake/Test/Case/View/Helper Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -6628,6 +6628,61 @@ public function testYearAutoExpandRange() {
6628
6628
$ this ->assertEquals ($ result , $ expected );
6629
6629
}
6630
6630
6631
+ /**
6632
+ * testInputDate method
6633
+ *
6634
+ * Test various inputs with type date and different dateFormat values
6635
+ *
6636
+ * @return void
6637
+ */
6638
+ public function testInputDate () {
6639
+ $ this ->Form ->request ->data = array ();
6640
+ $ this ->Form ->create ('User ' );
6641
+ $ result = $ this ->Form ->input ('month_year ' ,
6642
+ array (
6643
+ 'label ' => false ,
6644
+ 'div ' => false ,
6645
+ 'type ' => 'date ' ,
6646
+ 'dateFormat ' => 'MY ' ,
6647
+ 'minYear ' => 2006 ,
6648
+ 'maxYear ' => 2008
6649
+ )
6650
+ );
6651
+ $ this ->assertContains ('value=" ' . date ('m ' ) . '" selected="selected" ' , $ result );
6652
+ $ this ->assertContains ('value="2008" selected="selected" ' , $ result );
6653
+
6654
+ $ result = $ this ->Form ->input ('just_year ' ,
6655
+ array (
6656
+ 'type ' => 'date ' ,
6657
+ 'label ' => false ,
6658
+ 'dateFormat ' => 'Y ' ,
6659
+ 'minYear ' => date ('Y ' ),
6660
+ 'maxYear ' => date ('Y ' , strtotime ('+20 years ' ))
6661
+ )
6662
+ );
6663
+ $ this ->assertContains ('value=" ' . date ('Y ' ) . '" selected="selected" ' , $ result );
6664
+
6665
+ $ result = $ this ->Form ->input ('just_month ' ,
6666
+ array (
6667
+ 'type ' => 'date ' ,
6668
+ 'label ' => false ,
6669
+ 'dateFormat ' => 'M ' ,
6670
+ 'empty ' => false ,
6671
+ )
6672
+ );
6673
+ $ this ->assertContains ('value=" ' . date ('m ' ) . '" selected="selected" ' , $ result );
6674
+
6675
+ $ result = $ this ->Form ->input ('just_day ' ,
6676
+ array (
6677
+ 'type ' => 'date ' ,
6678
+ 'label ' => false ,
6679
+ 'dateFormat ' => 'D ' ,
6680
+ 'empty ' => false ,
6681
+ )
6682
+ );
6683
+ $ this ->assertContains ('value=" ' . date ('d ' ) . '" selected="selected" ' , $ result );
6684
+ }
6685
+
6631
6686
/**
6632
6687
* testInputDateMaxYear method
6633
6688
*
You can’t perform that action at this time.
0 commit comments