lithium\tests\cases\template\helper\FormTest::testCustomValueCheckbox PHP Method

testCustomValueCheckbox() public method

    public function testCustomValueCheckbox()
    {
        $result = $this->form->checkbox('foo', array('value' => 'HERO'));
        $this->assertTags($result, array(array('input' => array('type' => 'hidden', 'value' => '', 'name' => 'foo')), array('input' => array('type' => 'checkbox', 'value' => 'HERO', 'name' => 'foo', 'id' => 'Foo'))));
        $result = $this->form->checkbox('foo', array('value' => 'nose'));
        $this->assertTags($result, array(array('input' => array('type' => 'hidden', 'value' => '', 'name' => 'foo')), array('input' => array('type' => 'checkbox', 'value' => 'nose', 'name' => 'foo', 'id' => 'Foo'))));
        $record = new Record(array('model' => $this->_model, 'data' => array('foo' => 'nose')));
        $this->form->create($record);
        $result = $this->form->checkbox('foo', array('value' => 'nose'));
        $this->assertTags($result, array(array('input' => array('type' => 'hidden', 'value' => '', 'name' => 'foo')), array('input' => array('type' => 'checkbox', 'value' => 'nose', 'name' => 'foo', 'id' => 'MockFormPostFoo', 'checked' => 'checked'))));
        $record = new Record(array('model' => $this->_model, 'data' => array('foo' => 'foot')));
        $this->form->create($record);
        $result = $this->form->checkbox('foo', array('value' => 'nose'));
        $this->assertTags($result, array(array('input' => array('type' => 'hidden', 'value' => '', 'name' => 'foo')), array('input' => array('type' => 'checkbox', 'value' => 'nose', 'name' => 'foo', 'id' => 'MockFormPostFoo'))));
        $record = new Record(array('model' => $this->_model, 'data' => array('foo' => false)));
        $this->form->create($record);
        $result = $this->form->checkbox('foo', array('value' => '0'));
        $this->assertTags($result, array(array('input' => array('type' => 'hidden', 'value' => '', 'name' => 'foo')), array('input' => array('type' => 'checkbox', 'value' => '0', 'name' => 'foo', 'id' => 'MockFormPostFoo', 'checked' => 'checked'))));
    }
FormTest