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

testFormErrorMultipleBindings() public method

    public function testFormErrorMultipleBindings()
    {
        $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')));
        $record1->errors(array('title' => 'Not a cool title'));
        $record2->errors(array('section' => 'Not a cool section'));
        $this->form->create(compact('record1', 'record2'));
        $result = $this->form->error('title');
        $this->assertTags($result, array('div' => array('class' => 'error'), 'Not a cool title', '/div'));
        $result = $this->form->error('body');
        $this->assertEmpty($result);
        $result = $this->form->error('record1.title');
        $this->assertTags($result, array('div' => array('class' => 'error'), 'Not a cool title', '/div'));
        $result = $this->form->error('record2.section');
        $this->assertTags($result, array('div' => array('class' => 'error'), 'Not a cool section', '/div'));
    }
FormTest