Skip to content
Permalink
Browse files

Add a provider to test checked values.

These tests used to be in FormHelper, but fit better here.
  • Loading branch information...
markstory committed Feb 15, 2014
1 parent 4022d3d commit 3c1adc292ac14333e45708212283fa33679ab427
Showing with 17 additions and 2 deletions.
  1. +17 −2 tests/TestCase/View/Widget/CheckboxTest.php
@@ -145,17 +145,32 @@ public function testRenderChecked() {
$this->assertTags($result, $expected);
}
/**
* Data provider for checkbox values
*
* @return array
*/
public static function checkedProvider() {
return [
['checked'],
['1'],
[1],
[true],
];
}
/**
* Test rendering checked checkboxes with value.
*
* @dataProvider checkedProvider
* @return void
*/
public function testRenderCheckedValue() {
public function testRenderCheckedValue($checked) {
$checkbox = new Checkbox($this->templates);
$data = [
'name' => 'Comment[spam]',
'value' => 1,
'checked' => 1,
'checked' => $checked,
];
$result = $checkbox->render($data);
$expected = [

0 comments on commit 3c1adc2

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