From 9bab2440e7681bd847b006c513d36aade5d0fca2 Mon Sep 17 00:00:00 2001 From: nate Date: Sat, 26 Apr 2008 11:43:26 +0000 Subject: [PATCH] Adding Dispatcher test cases for POST data handling and method overrides git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6721 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/tests/cases/dispatcher.test.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cake/tests/cases/dispatcher.test.php b/cake/tests/cases/dispatcher.test.php index f915ebe75..be191f973 100644 --- a/cake/tests/cases/dispatcher.test.php +++ b/cake/tests/cases/dispatcher.test.php @@ -986,6 +986,20 @@ class DispatcherTest extends UnitTestCase { $result = $dispatcher->parseParams('/posts/5'); $expected = array('pass' => array('5'), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT', 'form' => array(), 'url' => array()); $this->assertEqual($result, $expected); + + $_POST['_method'] = 'POST'; + $_POST['data'] = array('Post' => array('title' => 'New Post')); + $_POST['extra'] = 'data'; + $_SERVER = array(); + + $result = $dispatcher->parseParams('/posts'); + $expected = array( + 'pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'add', + '[method]' => 'POST', 'form' => array('extra' => 'data'), 'data' => array('Post' => array('title' => 'New Post')), + 'url' => array() + ); + $this->assertEqual($result, $expected); + unset($_POST['_method']); }