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

testFormCreationMultipleBindings() public method

    public function testFormCreationMultipleBindings()
    {
        $record1 = new Record(array('model' => $this->_model, 'data' => array('author_id' => '2', 'title' => 'New post', 'body' => 'New post body')));
        $record2 = new Record(array('model' => $this->_model2, 'data' => array('section' => 'New post section', 'notes' => 'New post notes')));
        $result = $this->form->create(array('MockFormPost' => $record1, 'MockFormPostInfo' => $record2));
        $this->assertTags($result, array('form' => array('action' => "{$this->base}posts", 'method' => 'post')));
        $result = $this->form->text('title');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'title', 'value' => 'New post', 'id' => 'MockFormPostTitle')));
        $result = $this->form->text('MockFormPost.title');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'MockFormPost[title]', 'value' => 'New post', 'id' => 'MockFormPostTitle')));
        $result = $this->form->text('body');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'body', 'value' => 'New post body', 'id' => 'MockFormPostBody')));
        $result = $this->form->text('MockFormPostInfo.section');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'MockFormPostInfo[section]', 'value' => 'New post section', 'id' => 'MockFormPostInfoSection')));
        $result = $this->form->end();
        $this->assertTags($result, array('/form'));
        $result = $this->form->create(array('a' => $record1, 'b' => $record2));
        $this->assertTags($result, array('form' => array('action' => "{$this->base}posts", 'method' => 'post')));
        $result = $this->form->text('title');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'title', 'value' => 'New post', 'id' => 'MockFormPostTitle')));
        $result = $this->form->text('a.title');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'a[title]', 'value' => 'New post', 'id' => 'MockFormPostTitle')));
        $result = $this->form->text('body');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'body', 'value' => 'New post body', 'id' => 'MockFormPostBody')));
        $result = $this->form->text('b.section');
        $this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'b[section]', 'value' => 'New post section', 'id' => 'MockFormPostInfoSection')));
        $result = $this->form->end();
        $this->assertTags($result, array('/form'));
    }
FormTest