Browse Source

Add tests in an attempt to reproduce #10662

Mark Story 8 years ago
parent
commit
18f68aaa36
1 changed files with 15 additions and 0 deletions
  1. 15 0
      tests/TestCase/View/Helper/FormHelperTest.php

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

@@ -3249,6 +3249,21 @@ class FormHelperTest extends TestCase
     {
         $articles = TableRegistry::get('Articles');
         $articles->schema()->addColumn('active', ['type' => 'boolean', 'default' => null]);
+        $article = $articles->newEntity();
+
+        $this->Form->create($article);
+
+        $result = $this->Form->control('Articles.active');
+        $expected = [
+            'div' => ['class' => 'input checkbox'],
+            'input' => ['type' => 'hidden', 'name' => 'Articles[active]', 'value' => '0'],
+            'label' => ['for' => 'articles-active'],
+            ['input' => ['type' => 'checkbox', 'name' => 'Articles[active]', 'value' => '1', 'id' => 'articles-active']],
+            'Active',
+            '/label',
+            '/div'
+        ];
+        $this->assertHtml($expected, $result);
 
         $result = $this->Form->control('Articles.active', ['label' => false, 'checked' => true]);
         $expected = [