From 18f68aaa36d72dbd91a5eccad790af45dbaebfaa Mon Sep 17 00:00:00 2001 From: Mark Story Date: Wed, 17 May 2017 22:15:15 -0400 Subject: [PATCH] Add tests in an attempt to reproduce #10662 --- tests/TestCase/View/Helper/FormHelperTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/TestCase/View/Helper/FormHelperTest.php b/tests/TestCase/View/Helper/FormHelperTest.php index 014bce877e1..5f54a1f8d08 100644 --- a/tests/TestCase/View/Helper/FormHelperTest.php +++ b/tests/TestCase/View/Helper/FormHelperTest.php @@ -3249,6 +3249,21 @@ public function testControlCheckbox() { $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 = [