Browse Source

Add test for #6715

Years before the unix epoch work fine. I suspect the issue reporter has
0000-00-00 in their database.

Closes #6715
Mark Story 10 years ago
parent
commit
3ad0c5d850
1 changed files with 22 additions and 0 deletions
  1. 22 0
      tests/TestCase/View/Helper/FormHelperTest.php

+ 22 - 0
tests/TestCase/View/Helper/FormHelperTest.php

@@ -5830,6 +5830,28 @@ class FormHelperTest extends TestCase
     }
 
     /**
+     * Test minYear being prior to the unix epoch
+     *
+     * @return void
+     */
+    public function testInputDatetimePreEpoch()
+    {
+        $start = date('Y') - 80;
+        $end = date('Y') - 18;
+        $result = $this->Form->input('birth_year', [
+            'type' => 'date',
+            'label' => 'Birth Year',
+            'minYear' => $start,
+            'maxYear' => $end,
+            'month' => false,
+            'day' => false,
+        ]);
+        $this->assertContains('value="' . $start . '">' . $start, $result);
+        $this->assertContains('value="' . $end . '" selected="selected">' . $end, $result);
+        $this->assertNotContains('value="00">00', $result);
+    }
+
+    /**
      * testYearAutoExpandRange method
      *
      * @return void