Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding tests to show correct usage of form::create() with querystring…

… 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...
commit 377108f93092ef56e98375a73a4365d954e1b4aa 1 parent 32107f5
@markstory markstory authored
View
6 cake/tests/cases/libs/view/helper.test.php
@@ -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
View
26 cake/tests/cases/libs/view/helpers/form.test.php
@@ -4529,6 +4529,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
*
* @access public
Please sign in to comment.
Something went wrong with that request. Please try again.