lithium\tests\cases\template\helper\FormTest::testElementsWithDefaultConfiguration PHP Метод

testElementsWithDefaultConfiguration() публичный Метод

    public function testElementsWithDefaultConfiguration()
    {
        $this->form = new Form(array('context' => new MockFormRenderer(), 'base' => array('class' => 'editable')));
        $result = $this->form->text('foo');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'foo', 'class' => 'editable', 'id' => 'Foo')));
        $this->form->config(array('base' => array('maxlength' => 255)));
        $result = $this->form->text('foo');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'foo', 'class' => 'editable', 'maxlength' => '255', 'id' => 'Foo')));
        $this->form->config(array('text' => array('class' => 'locked')));
        $result = $this->form->text('foo');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'foo', 'class' => 'locked', 'maxlength' => '255', 'id' => 'Foo')));
        $result = $this->form->config();
        $expected = array('base' => array('class' => 'editable', 'maxlength' => 255), 'text' => array('class' => 'locked'), 'textarea' => array(), 'templates' => array('create' => 'form', 'end' => 'form-end'), 'attributes' => array('id' => $result['attributes']['id'], 'name' => $result['attributes']['name']));
        $this->assertEqual($expected, $result);
        $this->assertInternalType('callable', $result['attributes']['id']);
        $this->assertInternalType('callable', $result['attributes']['name']);
    }
FormTest