Skip to content
Permalink
Browse files

Rename test model usage to reflect models that exist.

Refs #10662
  • Loading branch information...
markstory committed May 18, 2017
1 parent 694fb9c commit a8c14fe559c289f68ed0fad46d9b6411d0240aa3
Showing with 22 additions and 19 deletions.
  1. +22 −19 tests/TestCase/View/Helper/FormHelperTest.php
@@ -3247,47 +3247,50 @@ public function testControlZero()
*/
public function testControlCheckbox()
{
$result = $this->Form->control('User.active', ['label' => false, 'checked' => true]);
$articles = TableRegistry::get('Articles');
$articles->schema()->addColumn('active', ['type' => 'boolean', 'default' => null]);
$result = $this->Form->control('Articles.active', ['label' => false, 'checked' => true]);
$expected = [
'div' => ['class' => 'input checkbox'],
'input' => ['type' => 'hidden', 'name' => 'User[active]', 'value' => '0'],
['input' => ['type' => 'checkbox', 'name' => 'User[active]', 'value' => '1', 'id' => 'user-active', 'checked' => 'checked']],
'input' => ['type' => 'hidden', 'name' => 'Articles[active]', 'value' => '0'],
['input' => ['type' => 'checkbox', 'name' => 'Articles[active]', 'value' => '1', 'id' => 'articles-active', 'checked' => 'checked']],
'/div'
];
$this->assertHtml($expected, $result);
$result = $this->Form->control('User.active', ['label' => false, 'checked' => 1]);
$result = $this->Form->control('Articles.active', ['label' => false, 'checked' => 1]);
$expected = [
'div' => ['class' => 'input checkbox'],
'input' => ['type' => 'hidden', 'name' => 'User[active]', 'value' => '0'],
['input' => ['type' => 'checkbox', 'name' => 'User[active]', 'value' => '1', 'id' => 'user-active', 'checked' => 'checked']],
'input' => ['type' => 'hidden', 'name' => 'Articles[active]', 'value' => '0'],
['input' => ['type' => 'checkbox', 'name' => 'Articles[active]', 'value' => '1', 'id' => 'articles-active', 'checked' => 'checked']],
'/div'
];
$this->assertHtml($expected, $result);
$result = $this->Form->control('User.active', ['label' => false, 'checked' => '1']);
$result = $this->Form->control('Articles.active', ['label' => false, 'checked' => '1']);
$expected = [
'div' => ['class' => 'input checkbox'],
'input' => ['type' => 'hidden', 'name' => 'User[active]', 'value' => '0'],
['input' => ['type' => 'checkbox', 'name' => 'User[active]', 'value' => '1', 'id' => 'user-active', 'checked' => 'checked']],
'input' => ['type' => 'hidden', 'name' => 'Articles[active]', 'value' => '0'],
['input' => ['type' => 'checkbox', 'name' => 'Articles[active]', 'value' => '1', 'id' => 'articles-active', 'checked' => 'checked']],
'/div'
];
$this->assertHtml($expected, $result);
$result = $this->Form->control('User.disabled', [
$result = $this->Form->control('Articles.disabled', [
'label' => 'Disabled',
'type' => 'checkbox',
'data-foo' => 'disabled'
]);
$expected = [
'div' => ['class' => 'input checkbox'],
'input' => ['type' => 'hidden', 'name' => 'User[disabled]', 'value' => '0'],
'label' => ['for' => 'user-disabled'],
'input' => ['type' => 'hidden', 'name' => 'Articles[disabled]', 'value' => '0'],
'label' => ['for' => 'articles-disabled'],
['input' => [
'type' => 'checkbox',
'name' => 'User[disabled]',
'name' => 'Articles[disabled]',
'value' => '1',
'id' => 'user-disabled',
'id' => 'articles-disabled',
'data-foo' => 'disabled'
]],
'Disabled',
@@ -3296,20 +3299,20 @@ public function testControlCheckbox()
];
$this->assertHtml($expected, $result);
$result = $this->Form->control('User.confirm', [
$result = $this->Form->control('Articles.confirm', [
'label' => 'Confirm <b>me</b>!',
'type' => 'checkbox',
'escape' => false
]);
$expected = [
'div' => ['class' => 'input checkbox'],
'input' => ['type' => 'hidden', 'name' => 'User[confirm]', 'value' => '0'],
'label' => ['for' => 'user-confirm'],
'input' => ['type' => 'hidden', 'name' => 'Articles[confirm]', 'value' => '0'],
'label' => ['for' => 'articles-confirm'],
['input' => [
'type' => 'checkbox',
'name' => 'User[confirm]',
'name' => 'Articles[confirm]',
'value' => '1',
'id' => 'user-confirm',
'id' => 'articles-confirm',
]],
'Confirm <b>me</b>!',
'/label',

0 comments on commit a8c14fe

Please sign in to comment.
You can’t perform that action at this time.