Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests in an attempt to reproduce #10662
  • Loading branch information
markstory committed May 18, 2017
1 parent a8c14fe commit 18f68aa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -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 = [
Expand Down

0 comments on commit 18f68aa

Please sign in to comment.