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

testRestFormCreation() public method

Tests creating forms with non-browser compatible HTTP methods, required for REST interfaces.
    public function testRestFormCreation()
    {
        $result = $this->form->create(null, array('action' => 'delete', 'method' => 'delete'));
        $this->assertTags($result, array('form' => array('action' => "{$this->base}posts/delete", 'method' => 'post'), 'input' => array('type' => "hidden", 'name' => '_method', 'value' => 'DELETE')));
        $result = $this->form->create(null, array('method' => 'put', 'type' => 'file'));
        $this->assertTags($result, array('form' => array('action' => "{$this->base}posts", 'method' => 'post', 'enctype' => 'multipart/form-data'), 'input' => array('type' => "hidden", 'name' => '_method', 'value' => 'PUT')));
        $record = new Record(array('exists' => true, 'model' => $this->_model));
        $result = $this->form->create($record);
        $this->assertTags($result, array('form' => array('action' => "{$this->base}posts", 'method' => 'post'), 'input' => array('type' => "hidden", 'name' => '_method', 'value' => 'PUT')));
    }
FormTest