Skip to content

Commit

Permalink
Adding tests to show correct usage of form::create() with querystring…
Browse files Browse the repository at this point in the history
… params. Closes #6278

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8144 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
markstory committed Apr 15, 2009
1 parent 32107f5 commit 377108f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cake/tests/cases/libs/view/helper.test.php
Expand Up @@ -383,6 +383,12 @@ function testUrlConversion() {
'controller' => 'posts', 'action' => 'index', 'param' => '%7Baround%20here%7D%5Bthings%5D%5Bare%5D%24%24'
));
$this->assertEqual($result, "/posts/index/param:%7Baround%20here%7D%5Bthings%5D%5Bare%5D%24%24");

$result = $this->Helper->url(array(
'controller' => 'posts', 'action' => 'index', 'page' => '1',
'?' => array('one' => 'value', 'two' => 'value', 'three' => 'purple')
));
$this->assertEqual($result, "/posts/index/page:1?one=value&two=value&three=purple");
}
/**
* testFieldsWithSameName method
Expand Down
26 changes: 26 additions & 0 deletions cake/tests/cases/libs/view/helpers/form.test.php
Expand Up @@ -4528,6 +4528,32 @@ function testFormCreate() {
);
$this->assertTags($result, $expected);
}
/**
* Test base form url when url param is passed with multiple parameters (&)
*
*/
function testFormCreateQuerystringParams() {
$result = $this->Form->create('Contact', array(
'type' => 'post',
'escape' => false,
'url' => array(
'controller' => 'controller',
'action' => 'action',
'?' => array('param1' => 'value1', 'param2' => 'value2')
)
));
$expected = array(
'form' => array(
'id' => 'ContactAddForm',
'method' => 'post',
'action' => '/controller/action/?param1=value1&param2=value2'
),
'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'),
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
'/fieldset'
);
$this->assertTags($result, $expected, true);
}
/**
* testGetFormCreate method
*
Expand Down

0 comments on commit 377108f

Please sign in to comment.