|
|
@@ -1,7 +1,5 @@
|
|
|
<?php
|
|
|
/**
|
|
|
- * ShellDispatcherTest file
|
|
|
- *
|
|
|
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
|
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
*
|
|
|
@@ -117,278 +115,6 @@ class ShellDispatcherTest extends TestCase {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * testParseParams method
|
|
|
- *
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function testParseParams() {
|
|
|
- $Dispatcher = new TestShellDispatcher();
|
|
|
-
|
|
|
- $params = array(
|
|
|
- '/cake/1.2.x.x/cake/console/cake.php',
|
|
|
- 'bake',
|
|
|
- '-app',
|
|
|
- 'new',
|
|
|
- '-working',
|
|
|
- '/var/www/htdocs'
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'new',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => $this->_normalizePath('/var/www/htdocs/new'),
|
|
|
- 'root' => $this->_normalizePath('/var/www/htdocs')
|
|
|
- );
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array('cake.php');
|
|
|
- $expected = array(
|
|
|
- 'app' => 'App',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'App'),
|
|
|
- 'root' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH)),
|
|
|
- );
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- 'cake.php',
|
|
|
- '-app',
|
|
|
- 'new',
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'new',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'new'),
|
|
|
- 'root' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH))
|
|
|
- );
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- './cake.php',
|
|
|
- 'bake',
|
|
|
- '-app',
|
|
|
- 'new',
|
|
|
- '-working',
|
|
|
- '/cake/1.2.x.x/cake/console'
|
|
|
- );
|
|
|
-
|
|
|
- $expected = array(
|
|
|
- 'app' => 'new',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'new'),
|
|
|
- 'root' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH))
|
|
|
- );
|
|
|
-
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- './console/cake.php',
|
|
|
- 'bake',
|
|
|
- '-app',
|
|
|
- 'new',
|
|
|
- '-working',
|
|
|
- '/cake/1.2.x.x/cake'
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'new',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'new'),
|
|
|
- 'root' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH))
|
|
|
- );
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- './console/cake.php',
|
|
|
- 'bake',
|
|
|
- '-app',
|
|
|
- 'new',
|
|
|
- '-dry',
|
|
|
- '-working',
|
|
|
- '/cake/1.2.x.x/cake'
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'new',
|
|
|
- 'working' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'new'),
|
|
|
- 'root' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH)),
|
|
|
- 'webroot' => 'webroot'
|
|
|
- );
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- './console/cake.php',
|
|
|
- '-working',
|
|
|
- '/cake/1.2.x.x/cake',
|
|
|
- 'schema',
|
|
|
- 'run',
|
|
|
- 'create',
|
|
|
- '-dry',
|
|
|
- '-f',
|
|
|
- '-name',
|
|
|
- 'DbAcl'
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'App',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'App'),
|
|
|
- 'root' => str_replace('\\', DS, dirname(CAKE_CORE_INCLUDE_PATH)),
|
|
|
- );
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $expected = array(
|
|
|
- './console/cake.php', 'schema', 'run', 'create', '-dry', '-f', '-name', 'DbAcl'
|
|
|
- );
|
|
|
- $this->assertEquals($expected, $Dispatcher->args);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- '/cake/1.2.x.x/cake/console/cake.php',
|
|
|
- '-working',
|
|
|
- '/cake/1.2.x.x/app',
|
|
|
- 'schema',
|
|
|
- 'run',
|
|
|
- 'create',
|
|
|
- '-dry',
|
|
|
- '-name',
|
|
|
- 'DbAcl'
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'app',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => $this->_normalizePath('/cake/1.2.x.x/app'),
|
|
|
- 'root' => $this->_normalizePath('/cake/1.2.x.x'),
|
|
|
- );
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- 'cake.php',
|
|
|
- '-working',
|
|
|
- 'C:/wamp/www/cake/app',
|
|
|
- 'bake',
|
|
|
- '-app',
|
|
|
- 'C:/wamp/www/apps/cake/app',
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'app',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => 'C:\wamp\www\apps\cake\app',
|
|
|
- 'root' => 'C:\wamp\www\apps\cake'
|
|
|
- );
|
|
|
-
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- 'cake.php',
|
|
|
- '-working',
|
|
|
- 'C:\wamp\www\cake\app',
|
|
|
- 'bake',
|
|
|
- '-app',
|
|
|
- 'C:\wamp\www\apps\cake\app',
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'app',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => 'C:\wamp\www\apps\cake\app',
|
|
|
- 'root' => 'C:\wamp\www\apps\cake'
|
|
|
- );
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- 'cake.php',
|
|
|
- '-working',
|
|
|
- 'C:\wamp\www\apps',
|
|
|
- 'bake',
|
|
|
- '-app',
|
|
|
- 'cake\app',
|
|
|
- '-url',
|
|
|
- 'http://example.com/some/url/with/a/path'
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'app',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => 'C:\wamp\www\apps\cake\app',
|
|
|
- 'root' => 'C:\wamp\www\apps\cake',
|
|
|
- );
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- '/home/amelo/dev/cake-common/cake/console/cake.php',
|
|
|
- '-root',
|
|
|
- '/home/amelo/dev/lsbu-vacancy',
|
|
|
- '-working',
|
|
|
- '/home/amelo/dev/lsbu-vacancy',
|
|
|
- '-app',
|
|
|
- 'app',
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'app',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => '/home/amelo/dev/lsbu-vacancy/app',
|
|
|
- 'root' => '/home/amelo/dev/lsbu-vacancy',
|
|
|
- );
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- $params = array(
|
|
|
- '/cake/1.2.x.x/cake/console/cake.php',
|
|
|
- 'bake',
|
|
|
- '-app',
|
|
|
- 'new',
|
|
|
- '-app',
|
|
|
- 'old',
|
|
|
- '-working',
|
|
|
- '/var/www/htdocs'
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'app' => 'old',
|
|
|
- 'webroot' => 'webroot',
|
|
|
- 'working' => $this->_normalizePath('/var/www/htdocs/old'),
|
|
|
- 'root' => $this->_normalizePath('/var/www/htdocs')
|
|
|
- );
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
-
|
|
|
- if (DS === '\\') {
|
|
|
- $params = array(
|
|
|
- 'cake.php',
|
|
|
- '-working',
|
|
|
- 'D:\www',
|
|
|
- 'bake',
|
|
|
- 'my_app',
|
|
|
- );
|
|
|
- $expected = array(
|
|
|
- 'working' => 'D:\\\\www',
|
|
|
- 'app' => 'www',
|
|
|
- 'root' => 'D:\\',
|
|
|
- 'webroot' => 'webroot'
|
|
|
- );
|
|
|
-
|
|
|
- $Dispatcher->params = $Dispatcher->args = array();
|
|
|
- $Dispatcher->parseParams($params);
|
|
|
- $this->assertEquals($expected, $Dispatcher->params);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-/**
|
|
|
* Verify loading of (plugin-) shells
|
|
|
*
|
|
|
* @return void
|