Removing all references to deprecated 'webservices' and 'bare' routes and route parameters, removing deprecated constants, updating core tests

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6453 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-02-11 06:18:41 +00:00
parent 50236e3431
commit f3355bd74b
12 changed files with 73 additions and 181 deletions

View file

@ -68,13 +68,6 @@ class Dispatcher extends Object {
* @access public * @access public
*/ */
var $admin = false; var $admin = false;
/**
* Webservice route
*
* @var string
* @access public
*/
var $webservices = null;
/** /**
* Plugin being served (if any) * Plugin being served (if any)
* *
@ -128,10 +121,9 @@ class Dispatcher extends Object {
if ($this->cached($url)) { if ($this->cached($url)) {
exit(); exit();
} }
$this->params = array_merge($this->parseParams($url), $additionalParams); $this->params = array_merge($this->parseParams($url), $additionalParams);
$controller = $this->__getController(); $controller = $this->__getController();
if (!is_object($controller)) { if (!is_object($controller)) {
Router::setRequestInfo(array($this->params, array('base' => $this->base, 'webroot' => $this->webroot))); Router::setRequestInfo(array($this->params, array('base' => $this->base, 'webroot' => $this->webroot)));
return $this->cakeError('missingController', array( return $this->cakeError('missingController', array(
@ -181,7 +173,6 @@ class Dispatcher extends Object {
$controller->plugin = $this->plugin; $controller->plugin = $this->plugin;
$controller->params =& $this->params; $controller->params =& $this->params;
$controller->action =& $this->params['action']; $controller->action =& $this->params['action'];
$controller->webservices =& $this->params['webservices'];
$controller->passedArgs = array_merge($this->params['pass'], $this->params['named']); $controller->passedArgs = array_merge($this->params['pass'], $this->params['named']);
if (!empty($this->params['data'])) { if (!empty($this->params['data'])) {
@ -213,11 +204,6 @@ class Dispatcher extends Object {
} }
} }
if (!is_null($controller->webservices)) {
array_push($controller->components, $controller->webservices);
array_push($controller->helpers, $controller->webservices);
}
Router::setRequestInfo(array($this->params, array('base' => $this->base, 'here' => $this->here, 'webroot' => $this->webroot))); Router::setRequestInfo(array($this->params, array('base' => $this->base, 'here' => $this->here, 'webroot' => $this->webroot)));
$controller->constructClasses(); $controller->constructClasses();
$this->start($controller); $this->start($controller);
@ -262,14 +248,13 @@ class Dispatcher extends Object {
) )
)); ));
} else { } else {
$output = call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? array(): $params['pass']); $output = $controller->dispatchMethod($params['action'], $params['pass']);
if (empty($controller->output)) {
$controller->output = $output;
}
} }
if ($controller->autoRender) { if ($controller->autoRender) {
$controller->output = $controller->render(); $controller->output = $controller->render();
} elseif (empty($controller->output)) {
$controller->output = $output;
} }
foreach ($controller->components as $c) { foreach ($controller->components as $c) {
@ -389,8 +374,6 @@ class Dispatcher extends Object {
} }
} }
} }
$params['bare'] = empty($params['ajax']) ? (empty($params['bare']) ? 0: 1) : 1;
$params['webservices'] = empty($params['webservices']) ? null : $params['webservices'];
return $params; return $params;
} }
/** /**

View file

@ -546,10 +546,9 @@ class Configure extends Object {
function __configVarNames($name) { function __configVarNames($name) {
if (is_string($name)) { if (is_string($name)) {
if (strpos($name, ".")) { if (strpos($name, ".")) {
$name = explode(".", $name); return explode(".", $name);
} else {
$name = array($name);
} }
return array($name);
} }
return $name; return $name;
} }
@ -638,60 +637,12 @@ class Configure extends Object {
} }
} }
$_this->__buildPaths(compact('modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths')); $_this->__buildPaths(compact('modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths'));
if (defined('BASE_URL')) {
trigger_error('BASE_URL Deprecated: See Configure::write(\'App.baseUrl\', \'' . BASE_URL . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('App.baseUrl', BASE_URL);
}
if (defined('DEBUG')) {
trigger_error('DEBUG Deprecated: Use Configure::write(\'debug\', ' . DEBUG . '); in APP/config/core.php', E_USER_WARNING);
$_this->write('debug', DEBUG);
}
if (defined('CAKE_ADMIN')) {
trigger_error('CAKE_ADMIN Deprecated: Use Configure::write(\'Routing.admin\', \'' . CAKE_ADMIN . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Routing.admin', CAKE_ADMIN);
}
if (defined('WEBSERVICES')) {
trigger_error('WEBSERVICES Deprecated: Use Router::parseExtensions(); or add Configure::write(\'Routing.webservices\', \'' . WEBSERVICES . '\');', E_USER_WARNING);
$_this->write('Routing.webservices', WEBSERVICES);
}
if (defined('ACL_CLASSNAME')) {
trigger_error('ACL_CLASSNAME Deprecated. Use Configure::write(\'Acl.classname\', \'' . ACL_CLASSNAME . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Acl.classname', ACL_CLASSNAME);
}
if (defined('ACL_DATABASE')) {
trigger_error('ACL_DATABASE Deprecated. Use Configure::write(\'Acl.database\', \'' . ACL_CLASSNAME . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Acl.database', ACL_CLASSNAME);
}
if (defined('CAKE_SESSION_SAVE')) {
trigger_error('CAKE_SESSION_SAVE Deprecated. Use Configure::write(\'Session.save\', \'' . CAKE_SESSION_SAVE . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Session.save', CAKE_SESSION_SAVE);
}
if (defined('CAKE_SESSION_TABLE')) {
trigger_error('CAKE_SESSION_TABLE Deprecated. Use Configure::write(\'Session.table\', \'' . CAKE_SESSION_TABLE . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Session.table', CAKE_SESSION_TABLE);
}
if (defined('CAKE_SESSION_STRING')) {
trigger_error('CAKE_SESSION_STRING Deprecated. Use Configure::write(\'Security.salt\', \'' . CAKE_SESSION_STRING . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Security.salt', CAKE_SESSION_STRING);
}
if (defined('CAKE_SESSION_COOKIE')) {
trigger_error('CAKE_SESSION_COOKIE Deprecated. Use Configure::write(\'Session.cookie\', \'' . CAKE_SESSION_COOKIE . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Session.cookie', CAKE_SESSION_COOKIE);
}
if (defined('CAKE_SECURITY')) {
trigger_error('CAKE_SECURITY Deprecated. Use Configure::write(\'Security.level\', \'' . CAKE_SECURITY . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Security.level', CAKE_SECURITY);
}
if (defined('CAKE_SESSION_TIMEOUT')) {
trigger_error('CAKE_SESSION_TIMEOUT Deprecated. Use Configure::write(\'Session.timeout\', \'' . CAKE_SESSION_TIMEOUT . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Session.timeout', CAKE_SESSION_TIMEOUT);
}
if (defined('AUTO_SESSION')) {
trigger_error('AUTO_SESSION Deprecated. Use Configure::write(\'Session.start\', \'' . AUTO_SESSION . '\'); in APP/config/core.php', E_USER_WARNING);
$_this->write('Session.start', (bool)AUTO_SESSION);
}
} }
/**
* Caches the object map when the instance of the Configure class is destroyed
*
* @access public
*/
function __destruct() { function __destruct() {
$_this = & Configure::getInstance(); $_this = & Configure::getInstance();

View file

@ -263,13 +263,6 @@ class Controller extends Object {
* @access public * @access public
*/ */
var $persistModel = false; var $persistModel = false;
/**
* Used in CakePHP webservices routing.
*
* @var array
* @access public
*/
var $webservices = null;
/** /**
* Holds all params passed and named. * Holds all params passed and named.
* *

View file

@ -121,7 +121,7 @@ class Scaffold extends Object {
* @var array * @var array
* @access private * @access private
*/ */
var $__passedVars = array('action', 'base', 'webroot', 'layout', 'name', 'viewPath', 'ext', 'params', 'data', 'webservices', 'plugin', 'cacheAction'); var $__passedVars = array('action', 'base', 'webroot', 'layout', 'name', 'viewPath', 'ext', 'params', 'data', 'plugin', 'cacheAction');
/** /**
* Title HTML element for current scaffolded view * Title HTML element for current scaffolded view
* *
@ -462,6 +462,7 @@ class Scaffold extends Object {
if (!class_exists('ThemeView')) { if (!class_exists('ThemeView')) {
App::import('View', 'Theme'); App::import('View', 'Theme');
} }
class ScaffoldView extends ThemeView { class ScaffoldView extends ThemeView {
/** /**
* Override _getViewFileName * Override _getViewFileName
@ -476,11 +477,6 @@ class ScaffoldView extends ThemeView {
$name = Inflector::underscore($name); $name = Inflector::underscore($name);
$scaffoldAction = 'scaffold.'.$name; $scaffoldAction = 'scaffold.'.$name;
if (!is_null($this->webservices)) {
$subDir = strtolower($this->webservices) . DS;
} else {
$subDir = null;
}
if (!is_null($this->subDir)) { if (!is_null($this->subDir)) {
$subDir = strtolower($this->subDir) . DS; $subDir = strtolower($this->subDir) . DS;
} else { } else {

View file

@ -503,23 +503,8 @@ class Router extends Object {
$_this->connect("/{$admin}/:controller/:action/*", $params); $_this->connect("/{$admin}/:controller/:action/*", $params);
} }
$_this->connect('/:controller', array('action' => 'index')); $_this->connect('/:controller', array('action' => 'index'));
/**
* Deprecated
*
*/
$_this->connect('/bare/:controller/:action/*', array('bare' => '1'));
$_this->connect('/ajax/:controller/:action/*', array('bare' => '1'));
if (Configure::read('Routing.webservices') == 'on') {
trigger_error('Deprecated: webservices routes are deprecated and will not be supported in future versions. Use Router::parseExtensions() instead.', E_USER_WARNING);
$_this->connect('/rest/:controller/:action/*', array('webservices' => 'Rest'));
$_this->connect('/rss/:controller/:action/*', array('webservices' => 'Rss'));
$_this->connect('/soap/:controller/:action/*', array('webservices' => 'Soap'));
$_this->connect('/xml/:controller/:action/*', array('webservices' => 'Xml'));
$_this->connect('/xmlrpc/:controller/:action/*', array('webservices' => 'XmlRpc'));
}
$_this->connect('/:controller/:action/*'); $_this->connect('/:controller/:action/*');
if (empty($_this->__namedArgs)) { if (empty($_this->__namedArgs)) {
$_this->connectNamed(array('page', 'fields', 'order', 'limit', 'recursive', 'sort', 'direction', 'step')); $_this->connectNamed(array('page', 'fields', 'order', 'limit', 'recursive', 'sort', 'direction', 'step'));
} }

View file

@ -255,9 +255,9 @@ class HtmlHelper extends AppHelper {
*/ */
function charset($charset = null) { function charset($charset = null) {
if (is_null($charset)) { if (is_null($charset)) {
$charset = Configure::read('App.encoding'); $charset = strtolower(Configure::read('App.encoding'));
if (!$charset) { if (!$charset) {
$charset = 'UTF-8'; $charset = 'utf-8';
} }
} }

View file

@ -29,7 +29,7 @@
/** /**
* Included libraries. * Included libraries.
*/ */
uses ('view' . DS . 'helper', 'class_registry'); App::import('Core', array('view' . DS . 'helper', 'ClassRegistry'));
/** /**
* View, the V in the MVC triad. * View, the V in the MVC triad.
@ -238,7 +238,7 @@ class View extends Object {
* @var array * @var array
* @access protected * @access protected
*/ */
var $__passedVars = array('viewVars', 'action', 'autoLayout', 'autoRender', 'ext', 'base', 'webroot', 'helpers', 'here', 'layout', 'name', 'pageTitle', 'layoutPath', 'viewPath', 'params', 'data', 'webservices', 'plugin', 'passedArgs', 'cacheAction'); var $__passedVars = array('viewVars', 'action', 'autoLayout', 'autoRender', 'ext', 'base', 'webroot', 'helpers', 'here', 'layout', 'name', 'pageTitle', 'layoutPath', 'viewPath', 'params', 'data', 'plugin', 'passedArgs', 'cacheAction');
/** /**
* Scripts (and/or other <head /> tags) for the layout * Scripts (and/or other <head /> tags) for the layout
* *
@ -696,7 +696,13 @@ class View extends Object {
$helpers[] = 'Session'; $helpers[] = 'Session';
} }
foreach ($helpers as $helper) { foreach ($helpers as $i => $helper) {
$options = array();
if (!is_int($i)) {
$options = $helper;
$helper = $i;
}
$parts = preg_split('/\/|\./', $helper); $parts = preg_split('/\/|\./', $helper);
if (count($parts) === 1) { if (count($parts) === 1) {
@ -728,8 +734,7 @@ class View extends Object {
exit(); exit();
} }
} }
$loaded[$helper] =& new $helperCn($options);
$loaded[$helper] =& new $helperCn();
$vars = array('base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin'); $vars = array('base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin');
$c = count($vars); $c = count($vars);
@ -740,12 +745,10 @@ class View extends Object {
if (!empty($this->validationErrors)) { if (!empty($this->validationErrors)) {
$loaded[$helper]->validationErrors = $this->validationErrors; $loaded[$helper]->validationErrors = $this->validationErrors;
} }
if (is_array($loaded[$helper]->helpers) && !empty($loaded[$helper]->helpers)) { if (is_array($loaded[$helper]->helpers) && !empty($loaded[$helper]->helpers)) {
$loaded =& $this->_loadHelpers($loaded, $loaded[$helper]->helpers, $helper); $loaded =& $this->_loadHelpers($loaded, $loaded[$helper]->helpers, $helper);
} }
} }
if (isset($loaded[$parent])) { if (isset($loaded[$parent])) {
$loaded[$parent]->{$helper} =& $loaded[$helper]; $loaded[$parent]->{$helper} =& $loaded[$helper];
} }
@ -764,9 +767,6 @@ class View extends Object {
function _getViewFileName($name = null) { function _getViewFileName($name = null) {
$subDir = null; $subDir = null;
if (!is_null($this->webservices)) {
$subDir = strtolower($this->webservices) . DS;
}
if (!is_null($this->subDir)) { if (!is_null($this->subDir)) {
$subDir = $this->subDir . DS; $subDir = $this->subDir . DS;
} }

View file

@ -708,12 +708,12 @@ class DispatcherTest extends UnitTestCase {
$result = $Dispatcher->parseParams($url); $result = $Dispatcher->parseParams($url);
$expected = array('pass' => array('home'), $expected = array(
'named' => array('param'=> 'value', 'param2'=> 'value2'), 'pass' => array('home'),
'plugin'=> 'my_plugin', 'controller'=> 'some_pages', 'action'=> 'display', 'named' => array('param'=> 'value', 'param2'=> 'value2'), 'plugin'=> 'my_plugin',
'form'=> null, //array('testdata'=> 'My Posted Data'), 'controller'=> 'some_pages', 'action'=> 'display', 'form'=> null,
'url'=> array('url'=> 'my_plugin/some_pages/home/param:value/param2:value2'), 'url'=> array('url'=> 'my_plugin/some_pages/home/param:value/param2:value2'),
'bare'=> 0, 'webservices'=> ''); );
ksort($expected); ksort($expected);
ksort($result); ksort($result);
@ -841,9 +841,9 @@ class DispatcherTest extends UnitTestCase {
$expected = 'admin_index'; $expected = 'admin_index';
$this->assertIdentical($controller->action, $expected); $this->assertIdentical($controller->action, $expected);
$expected = array('pass'=> array(), 'named' => array(), 'controller' => 'articles_test', 'plugin' => 'articles_test', 'action' => 'admin_index', $expected = array(
'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/articles_test'), 'pass'=> array(), 'named' => array(), 'controller' => 'articles_test', 'plugin' => 'articles_test', 'action' => 'admin_index',
'bare' => 0, 'webservices' => null, 'return' => 1 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/articles_test'), 'return' => 1
); );
$this->assertEqual($controller->params, $expected); $this->assertEqual($controller->params, $expected);
} }
@ -1003,27 +1003,27 @@ class DispatcherTest extends UnitTestCase {
$dispatcher->base = false; $dispatcher->base = false;
$result = $dispatcher->parseParams('/posts'); $result = $dispatcher->parseParams('/posts');
$expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'add', '[method]' => 'POST', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null); $expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'add', '[method]' => 'POST', 'form' => array(), 'url' => array());
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'PUT'; $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'PUT';
$result = $dispatcher->parseParams('/posts/5'); $result = $dispatcher->parseParams('/posts/5');
$expected = array('pass' => array(), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null); $expected = array('pass' => array(), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT', 'form' => array(), 'url' => array());
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
unset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']); unset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
$_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REQUEST_METHOD'] = 'GET';
$result = $dispatcher->parseParams('/posts/5'); $result = $dispatcher->parseParams('/posts/5');
$expected = array('pass' => array(), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'view', '[method]' => 'GET', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null); $expected = array('pass' => array(), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'view', '[method]' => 'GET', 'form' => array(), 'url' => array());
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$_POST['_method'] = 'PUT'; $_POST['_method'] = 'PUT';
$result = $dispatcher->parseParams('/posts/5'); $result = $dispatcher->parseParams('/posts/5');
$expected = array('pass' => array(), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null); $expected = array('pass' => array(), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT', 'form' => array(), 'url' => array());
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
unset($_POST['_method']); unset($_POST['_method']);
} }

View file

@ -68,7 +68,7 @@ class AuthTestController extends Controller {
function __construct() { function __construct() {
$this->params = Router::parse('/auth_test'); $this->params = Router::parse('/auth_test');
Router::setRequestInfo(array($this->params, array('base' => null, 'here' => '/auth_test', 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webservices' => null))); Router::setRequestInfo(array($this->params, array('base' => null, 'here' => '/auth_test', 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array())));
parent::__construct(); parent::__construct();
} }

View file

@ -152,12 +152,11 @@ TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
View::$fieldSuffix = NULL View::$fieldSuffix = NULL
View::$modelId = NULL View::$modelId = NULL
View::$uuids = array() View::$uuids = array()
View::$__passedVars = array("viewVars","action","autoLayout","autoRender","ext","base","webroot","helpers","here","layout","name","pageTitle","layoutPath","viewPath","params","data","webservices","plugin","passedArgs","cacheAction") View::$__passedVars = array("viewVars","action","autoLayout","autoRender","ext","base","webroot","helpers","here","layout","name","pageTitle","layoutPath","viewPath","params","data","plugin","passedArgs","cacheAction")
View::$__scripts = array() View::$__scripts = array()
View::$__paths = array() View::$__paths = array()
View::$_log = NULL View::$_log = NULL
View::$webroot = NULL View::$webroot = NULL
View::$webservices = NULL
View::element() View::element()
View::render() View::render()
View::renderElement() View::renderElement()
@ -173,6 +172,7 @@ TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
View::Object() View::Object()
View::toString() View::toString()
View::requestAction() View::requestAction()
View::dispatchMethod()
View::log() View::log()
View::cakeError()'; View::cakeError()';
$result = str_replace(array("\t", "\r\n", "\n"), "", $result); $result = str_replace(array("\t", "\r\n", "\n"), "", $result);

View file

@ -223,12 +223,11 @@ class RouterTest extends UnitTestCase {
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array( array(
'pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'subscriptions', 'pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'subscriptions',
'admin' => true, 'url' => array('url' => 'admin/subscriptions/index/page:2'), 'bare' => 0, 'webservices' => '' 'admin' => true, 'url' => array('url' => 'admin/subscriptions/index/page:2'),
), ),
array( array(
'base' => '/magazine', 'here' => '/magazine/admin/subscriptions/index/page:2', 'base' => '/magazine', 'here' => '/magazine/admin/subscriptions/index/page:2',
'webroot' => '/magazine/', 'passedArgs' => array('page' => 2), 'webroot' => '/magazine/', 'passedArgs' => array('page' => 2),
'webservices' => null
) )
)); ));
$this->router->parse('/'); $this->router->parse('/');
@ -243,12 +242,11 @@ class RouterTest extends UnitTestCase {
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array( array(
'pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'subscribe', 'pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'subscribe',
'admin' => true, 'url' => array('url' => 'admin/subscriptions/edit/1'), 'bare' => 0, 'webservices' => '' 'admin' => true, 'url' => array('url' => 'admin/subscriptions/edit/1')
), ),
array( array(
'base' => '/magazine', 'here' => '/magazine/admin/subscriptions/edit/1', 'base' => '/magazine', 'here' => '/magazine/admin/subscriptions/edit/1',
'webroot' => '/magazine/', 'passedArgs' => array('page' => 2), 'namedArgs' => array('page' => 2), 'webroot' => '/magazine/', 'passedArgs' => array('page' => 2), 'namedArgs' => array('page' => 2),
'webservices' => null
) )
)); ));
$this->router->parse('/'); $this->router->parse('/');
@ -259,14 +257,10 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array( array('pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'real_controller_name', 'url' => array('url' => '')),
'pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'real_controller_name',
'url' => array('url' => ''), 'bare' => 0, 'webservices' => ''
),
array( array(
'base' => '/', 'here' => '/', 'base' => '/', 'here' => '/',
'webroot' => '/', 'passedArgs' => array('page' => 2), 'namedArgs' => array('page' => 2), 'webroot' => '/', 'passedArgs' => array('page' => 2), 'namedArgs' => array('page' => 2),
'webservices' => null
) )
)); ));
$this->router->connect('short_controller_name/:action/*', array('controller' => 'real_controller_name')); $this->router->connect('short_controller_name/:action/*', array('controller' => 'real_controller_name'));
@ -332,14 +326,10 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->parse('/'); $this->router->parse('/');
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array( array('pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'users', 'url' => array('url' => 'users')),
'pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'users',
'url' => array('url' => 'users'), 'bare' => 0, 'webservices' => ''
),
array( array(
'base' => '/', 'here' => '/', 'base' => '/', 'here' => '/',
'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(),
'webservices' => null
) )
)); ));
@ -405,14 +395,10 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array( array('pass' => array(), 'admin' => true, 'action' => 'index', 'plugin' => null, 'controller' => 'users', 'url' => array('url' => 'users')),
'pass' => array(), 'admin' => true, 'action' => 'index', 'plugin' => null, 'controller' => 'users',
'url' => array('url' => 'users'), 'bare' => 0, 'webservices' => ''
),
array( array(
'base' => '/', 'here' => '/', 'base' => '/', 'here' => '/',
'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(),
'webservices' => null
) )
)); ));
@ -429,12 +415,11 @@ class RouterTest extends UnitTestCase {
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array( array(
'pass' => array(), 'action' => 'index', 'plugin' => 'myplugin', 'controller' => 'mycontroller', 'pass' => array(), 'action' => 'index', 'plugin' => 'myplugin', 'controller' => 'mycontroller',
'admin' => false, 'url' => array('url' => array()), 'bare' => 0, 'webservices' => '' 'admin' => false, 'url' => array('url' => array())
), ),
array( array(
'base' => '/', 'here' => '/', 'base' => '/', 'here' => '/',
'webroot' => '/', 'passedArgs' => array(), 'namedArgs' => array(), 'webroot' => '/', 'passedArgs' => array(), 'namedArgs' => array(),
'webservices' => null
) )
)); ));
@ -443,11 +428,10 @@ class RouterTest extends UnitTestCase {
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
Configure::write('Routing.admin', 'admin'); Configure::write('Routing.admin', 'admin');
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('plugin' => null, 'controller' => 'pages', 'action' => 'admin_add', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/add'), 'bare' => 0, 'webservices' => null), array('plugin' => null, 'controller' => 'pages', 'action' => 'admin_add', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/add')),
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/add', 'webroot' => '/') array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/add', 'webroot' => '/')
)); ));
$this->router->parse('/'); $this->router->parse('/');
@ -459,7 +443,7 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array ('plugin' => null, 'controller' => 'pages', 'action' => 'admin_edit', 'pass' => array('284'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/edit/284'), 'bare' => 0, 'webservices' => null), array ('plugin' => null, 'controller' => 'pages', 'action' => 'admin_edit', 'pass' => array('284'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/edit/284')),
array ('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/edit/284', 'webroot' => '/') array ('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/edit/284', 'webroot' => '/')
)); ));
@ -473,7 +457,7 @@ class RouterTest extends UnitTestCase {
Configure::write('Routing.admin', 'admin'); Configure::write('Routing.admin', 'admin');
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array ('plugin' => null, 'controller' => 'pages', 'action' => 'admin_add', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/add'), 'bare' => 0, 'webservices' => null), array ('plugin' => null, 'controller' => 'pages', 'action' => 'admin_add', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/add')),
array ('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/add', 'webroot' => '/') array ('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/add', 'webroot' => '/')
)); ));
@ -486,7 +470,7 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('plugin' => null, 'controller' => 'pages', 'action' => 'admin_edit', 'pass' => array('284'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/edit/284'), 'bare' => 0, 'webservices' => null), array('plugin' => null, 'controller' => 'pages', 'action' => 'admin_edit', 'pass' => array('284'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/edit/284')),
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/edit/284', 'webroot' => '/') array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/edit/284', 'webroot' => '/')
)); ));
@ -500,7 +484,7 @@ class RouterTest extends UnitTestCase {
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array ('plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'admin_edit', 'pass' => array ('plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'admin_edit', 'pass' =>
array (0 => '6'), 'prefix' => 'admin', 'admin' => true, 'form' => array (), 'url' => array (0 => '6'), 'prefix' => 'admin', 'admin' => true, 'form' => array (), 'url' =>
array ('url' => 'admin/shows/show_tickets/edit/6'), 'bare' => 0, 'webservices' => NULL), array ('url' => 'admin/shows/show_tickets/edit/6')),
array ('plugin' => NULL, 'controller' => NULL, 'action' => NULL, 'base' => '', 'here' => '/admin/shows/show_tickets/edit/6', 'webroot' => '/'))); array ('plugin' => NULL, 'controller' => NULL, 'action' => NULL, 'base' => '', 'here' => '/admin/shows/show_tickets/edit/6', 'webroot' => '/')));
$this->router->parse('/'); $this->router->parse('/');
@ -534,11 +518,11 @@ class RouterTest extends UnitTestCase {
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array( array(
'controller' => 'controller', 'action' => 'index', 'form' => array(), 'controller' => 'controller', 'action' => 'index', 'form' => array(),
'url' => array(), 'bare' => 0, 'webservices' => null, 'plugin' => 'test' 'url' => array(), 'plugin' => 'test'
), ),
array( array(
'base' => '/base', 'here' => '/clients/sage/portal/donations', 'webroot' => '/base/', 'base' => '/base', 'here' => '/clients/sage/portal/donations', 'webroot' => '/base/',
'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webservices' => null 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array()
) )
)); ));
@ -683,8 +667,8 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('admin' => true, 'controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null, 'plugin' => null), array('admin' => true, 'controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'plugin' => null),
array('base' => '/', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webservices' => null) array('base' => '/', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array())
)); ));
$this->router->parse('/'); $this->router->parse('/');
@ -705,8 +689,8 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('beheer' => true, 'controller' => 'posts', 'action' => 'index', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null, 'plugin' => null), array('beheer' => true, 'controller' => 'posts', 'action' => 'index', 'form' => array(), 'url' => array(), 'plugin' => null),
array('base' => '/', 'here' => '/beheer/posts/index', 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webservices' => null) array('base' => '/', 'here' => '/beheer/posts/index', 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array())
)); ));
$result = $this->router->parse('beheer/users/view/'); $result = $this->router->parse('beheer/users/view/');
@ -809,8 +793,8 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('admin' => true, 'controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null, 'plugin' => null), array('admin' => true, 'controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'plugin' => null),
array('base' => '/', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webservices' => null) array('base' => '/', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array())
)); ));
$this->router->parse('/'); $this->router->parse('/');
@ -820,8 +804,8 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('admin' => true, 'controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null, 'plugin' => null), array('admin' => true, 'controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'plugin' => null),
array('base' => '/', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array('type'=> 'whatever'), 'argSeparator' => ':', 'namedArgs' => array('type'=> 'whatever'), 'webservices' => null) array('base' => '/', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array('type'=> 'whatever'), 'argSeparator' => ':', 'namedArgs' => array('type'=> 'whatever'))
)); ));
$this->router->connectNamed(array('type')); $this->router->connectNamed(array('type'));
@ -851,7 +835,7 @@ class RouterTest extends UnitTestCase {
$this->router->parse('/'); $this->router->parse('/');
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('plugin' => null, 'controller' => 'images', 'action' => 'index', 'pass' => array(), 'prefix' => null, 'admin' => false, 'form' => array(), 'url' => array('url' => 'images/index'), 'bare' => 0, 'webservices' => null), array('plugin' => null, 'controller' => 'images', 'action' => 'index', 'pass' => array(), 'prefix' => null, 'admin' => false, 'form' => array(), 'url' => array('url' => 'images/index')),
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/images/index', 'webroot' => '/') array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/images/index', 'webroot' => '/')
)); ));
@ -867,8 +851,8 @@ class RouterTest extends UnitTestCase {
function testRemoveBase() { function testRemoveBase() {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null, 'plugin' => null), array('controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'bare' => 0, 'plugin' => null),
array('base' => '/base', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webservices' => null) array('base' => '/base', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array())
)); ));
$result = $this->router->url(array('controller' => 'my_controller', 'action' => 'my_action')); $result = $this->router->url(array('controller' => 'my_controller', 'action' => 'my_action'));
@ -938,8 +922,8 @@ class RouterTest extends UnitTestCase {
$this->router->connect('/admin/:controller/:action/*', $adminParams); $this->router->connect('/admin/:controller/:action/*', $adminParams);
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'bare' => 0, 'webservices' => null, 'plugin' => null), array('controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'plugin' => null),
array('base' => '/base', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webservices' => null) array('base' => '/base', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array())
)); ));
$result = $this->router->parse('/admin/posts/'); $result = $this->router->parse('/admin/posts/');
@ -976,7 +960,7 @@ class RouterTest extends UnitTestCase {
$this->router->reload(); $this->router->reload();
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('plugin' => null, 'controller' => 'images', 'action' => 'index', 'pass' => array(), 'named' => array(), 'prefix' => 'protected', 'admin' => false, 'form' => array(), 'url' => array ('url' => 'protected/images/index'), 'bare' => 0, 'webservices' => null), array('plugin' => null, 'controller' => 'images', 'action' => 'index', 'pass' => array(), 'named' => array(), 'prefix' => 'protected', 'admin' => false, 'form' => array(), 'url' => array ('url' => 'protected/images/index')),
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/protected/images/index', 'webroot' => '/') array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/protected/images/index', 'webroot' => '/')
)); ));
@ -1016,7 +1000,7 @@ class RouterTest extends UnitTestCase {
$this->router->connect('/:locale/:controller/:action/*', array(), array('locale' => 'dan|eng')); $this->router->connect('/:locale/:controller/:action/*', array(), array('locale' => 'dan|eng'));
$this->router->setRequestInfo(array( $this->router->setRequestInfo(array(
array('plugin' => null, 'controller' => 'test', 'action' => 'index', 'pass' => array(), 'form' => array(), 'url' => array ('url' => 'test/test_action'), 'bare' => 0, 'webservices' => null), array('plugin' => null, 'controller' => 'test', 'action' => 'index', 'pass' => array(), 'form' => array(), 'url' => array ('url' => 'test/test_action')),
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/test/test_action', 'webroot' => '/') array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/test/test_action', 'webroot' => '/')
)); ));

View file

@ -123,7 +123,7 @@ class PaginatorTest extends UnitTestCase {
Router::reload(); Router::reload();
Configure::write('Routing.admin', 'admin'); Configure::write('Routing.admin', 'admin');
Router::setRequestInfo(array( Router::setRequestInfo(array(
array('plugin' => null, 'controller' => 'test', 'action' => 'admin_index', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/test'), 'bare' => 0, 'webservices' => null), array('plugin' => null, 'controller' => 'test', 'action' => 'admin_index', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/test')),
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/test', 'webroot' => '/') array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/test', 'webroot' => '/')
)); ));
Router::parse('/'); Router::parse('/');