mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Migrating DispatcherTest to PHPUnit, alos removing class dependencies from test folder home.ctp file
This commit is contained in:
parent
c5e4ab2366
commit
08bcf4a615
2 changed files with 66 additions and 71 deletions
|
@ -42,14 +42,11 @@ class TestDispatcher extends Dispatcher {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _invoke(&$controller, $params) {
|
protected function _invoke(&$controller, $params) {
|
||||||
restore_error_handler();
|
|
||||||
if ($result = parent::_invoke($controller, $params)) {
|
if ($result = parent::_invoke($controller, $params)) {
|
||||||
if ($result[0] === 'missingAction') {
|
if ($result[0] === 'missingAction') {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set_error_handler('simpleTestErrorHandler');
|
|
||||||
|
|
||||||
return $controller;
|
return $controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +534,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function startTest() {
|
public function setUp() {
|
||||||
$this->_get = $_GET;
|
$this->_get = $_GET;
|
||||||
$_GET = array();
|
$_GET = array();
|
||||||
$this->_post = $_POST;
|
$this->_post = $_POST;
|
||||||
|
@ -563,7 +560,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function endTest() {
|
public function tearDown() {
|
||||||
$_GET = $this->_get;
|
$_GET = $this->_get;
|
||||||
$_POST = $this->_post;
|
$_POST = $this->_post;
|
||||||
$_FILES = $this->_files;
|
$_FILES = $this->_files;
|
||||||
|
@ -580,7 +577,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testParseParamsWithoutZerosAndEmptyPost() {
|
public function testParseParamsWithoutZerosAndEmptyPost() {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$test = $Dispatcher->parseParams("/testcontroller/testaction/params1/params2/params3");
|
$test = $Dispatcher->parseParams("/testcontroller/testaction/params1/params2/params3");
|
||||||
$this->assertIdentical($test['controller'], 'testcontroller');
|
$this->assertIdentical($test['controller'], 'testcontroller');
|
||||||
$this->assertIdentical($test['action'], 'testaction');
|
$this->assertIdentical($test['action'], 'testaction');
|
||||||
|
@ -597,10 +594,10 @@ class DispatcherTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testParseParamsReturnsPostedData() {
|
public function testParseParamsReturnsPostedData() {
|
||||||
$_POST['testdata'] = "My Posted Content";
|
$_POST['testdata'] = "My Posted Content";
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$test = $Dispatcher->parseParams("/");
|
$test = $Dispatcher->parseParams("/");
|
||||||
$this->assertTrue($test['form'], "Parsed URL not returning post data");
|
$this->assertFalse(empty($test['form']), "Parsed URL not returning post data");
|
||||||
$this->assertIdentical($test['form']['testdata'], "My Posted Content");
|
$this->assertEquals($test['form']['testdata'], "My Posted Content");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -609,7 +606,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testParseParamsWithSingleZero() {
|
public function testParseParamsWithSingleZero() {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$test = $Dispatcher->parseParams("/testcontroller/testaction/1/0/23");
|
$test = $Dispatcher->parseParams("/testcontroller/testaction/1/0/23");
|
||||||
$this->assertIdentical($test['controller'], 'testcontroller');
|
$this->assertIdentical($test['controller'], 'testcontroller');
|
||||||
$this->assertIdentical($test['action'], 'testaction');
|
$this->assertIdentical($test['action'], 'testaction');
|
||||||
|
@ -624,7 +621,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testParseParamsWithManySingleZeros() {
|
public function testParseParamsWithManySingleZeros() {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$test = $Dispatcher->parseParams("/testcontroller/testaction/0/0/0/0/0/0");
|
$test = $Dispatcher->parseParams("/testcontroller/testaction/0/0/0/0/0/0");
|
||||||
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][0]);
|
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][0]);
|
||||||
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][1]);
|
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][1]);
|
||||||
|
@ -640,7 +637,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testParseParamsWithManyZerosInEachSectionOfUrl() {
|
public function testParseParamsWithManyZerosInEachSectionOfUrl() {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$test = $Dispatcher->parseParams("/testcontroller/testaction/000/0000/00000/000000/000000/0000000");
|
$test = $Dispatcher->parseParams("/testcontroller/testaction/000/0000/00000/000000/000000/0000000");
|
||||||
$this->assertPattern('/\\A(?:000)\\z/', $test['pass'][0]);
|
$this->assertPattern('/\\A(?:000)\\z/', $test['pass'][0]);
|
||||||
$this->assertPattern('/\\A(?:0000)\\z/', $test['pass'][1]);
|
$this->assertPattern('/\\A(?:0000)\\z/', $test['pass'][1]);
|
||||||
|
@ -656,7 +653,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl() {
|
public function testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl() {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$test = $Dispatcher->parseParams("/testcontroller/testaction/01/0403/04010/000002/000030/0000400");
|
$test = $Dispatcher->parseParams("/testcontroller/testaction/01/0403/04010/000002/000030/0000400");
|
||||||
$this->assertPattern('/\\A(?:01)\\z/', $test['pass'][0]);
|
$this->assertPattern('/\\A(?:01)\\z/', $test['pass'][0]);
|
||||||
$this->assertPattern('/\\A(?:0403)\\z/', $test['pass'][1]);
|
$this->assertPattern('/\\A(?:0403)\\z/', $test['pass'][1]);
|
||||||
|
@ -677,7 +674,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
|
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
|
||||||
|
|
||||||
$_GET = array('coffee' => 'life', 'sleep' => 'sissies');
|
$_GET = array('coffee' => 'life', 'sleep' => 'sissies');
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$uri = 'posts/home/?coffee=life&sleep=sissies';
|
$uri = 'posts/home/?coffee=life&sleep=sissies';
|
||||||
$result = $Dispatcher->parseParams($uri);
|
$result = $Dispatcher->parseParams($uri);
|
||||||
$this->assertPattern('/posts/', $result['controller']);
|
$this->assertPattern('/posts/', $result['controller']);
|
||||||
|
@ -685,7 +682,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$this->assertTrue(isset($result['url']['sleep']));
|
$this->assertTrue(isset($result['url']['sleep']));
|
||||||
$this->assertTrue(isset($result['url']['coffee']));
|
$this->assertTrue(isset($result['url']['coffee']));
|
||||||
|
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$uri = '/?coffee=life&sleep=sissy';
|
$uri = '/?coffee=life&sleep=sissy';
|
||||||
$result = $Dispatcher->parseParams($uri);
|
$result = $Dispatcher->parseParams($uri);
|
||||||
$this->assertPattern('/pages/', $result['controller']);
|
$this->assertPattern('/pages/', $result['controller']);
|
||||||
|
@ -748,7 +745,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$result = $Dispatcher->parseParams('/');
|
$result = $Dispatcher->parseParams('/');
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -866,7 +863,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$result = $Dispatcher->parseParams('/');
|
$result = $Dispatcher->parseParams('/');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Document' => array(
|
'Document' => array(
|
||||||
|
@ -931,7 +928,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$result = $Dispatcher->parseParams('/');
|
$result = $Dispatcher->parseParams('/');
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -953,7 +950,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testGetUrl() {
|
public function testGetUrl() {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$Dispatcher->base = '/app/webroot/index.php';
|
$Dispatcher->base = '/app/webroot/index.php';
|
||||||
$uri = '/app/webroot/index.php/posts/add';
|
$uri = '/app/webroot/index.php/posts/add';
|
||||||
$result = $Dispatcher->getUrl($uri);
|
$result = $Dispatcher->getUrl($uri);
|
||||||
|
@ -969,7 +966,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
|
|
||||||
$_GET['url'] = array();
|
$_GET['url'] = array();
|
||||||
Configure::write('App.base', '/control');
|
Configure::write('App.base', '/control');
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$Dispatcher->baseUrl();
|
$Dispatcher->baseUrl();
|
||||||
$uri = '/control/students/browse';
|
$uri = '/control/students/browse';
|
||||||
$result = $Dispatcher->getUrl($uri);
|
$result = $Dispatcher->getUrl($uri);
|
||||||
|
@ -977,7 +974,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$this->assertEqual($expected, $result);
|
$this->assertEqual($expected, $result);
|
||||||
|
|
||||||
$_GET['url'] = array();
|
$_GET['url'] = array();
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$Dispatcher->base = '';
|
$Dispatcher->base = '';
|
||||||
$uri = '/?/home';
|
$uri = '/?/home';
|
||||||
$result = $Dispatcher->getUrl($uri);
|
$result = $Dispatcher->getUrl($uri);
|
||||||
|
@ -992,7 +989,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBaseUrlAndWebrootWithModRewrite() {
|
public function testBaseUrlAndWebrootWithModRewrite() {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
|
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches';
|
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches';
|
||||||
|
@ -1073,7 +1070,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
|
|
||||||
Configure::write('App.base', '/control');
|
Configure::write('App.base', '/control');
|
||||||
|
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$result = $Dispatcher->baseUrl();
|
$result = $Dispatcher->baseUrl();
|
||||||
$expected = '/control';
|
$expected = '/control';
|
||||||
$this->assertEqual($expected, $result);
|
$this->assertEqual($expected, $result);
|
||||||
|
@ -1087,7 +1084,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$_SERVER['DOCUMENT_ROOT'] = '/var/www/abtravaff/html';
|
$_SERVER['DOCUMENT_ROOT'] = '/var/www/abtravaff/html';
|
||||||
$_SERVER['SCRIPT_FILENAME'] = '/var/www/abtravaff/html/newaffiliate/index.php';
|
$_SERVER['SCRIPT_FILENAME'] = '/var/www/abtravaff/html/newaffiliate/index.php';
|
||||||
$_SERVER['PHP_SELF'] = '/newaffiliate/index.php';
|
$_SERVER['PHP_SELF'] = '/newaffiliate/index.php';
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$result = $Dispatcher->baseUrl();
|
$result = $Dispatcher->baseUrl();
|
||||||
$expected = '/newaffiliate';
|
$expected = '/newaffiliate';
|
||||||
$this->assertEqual($expected, $result);
|
$this->assertEqual($expected, $result);
|
||||||
|
@ -1101,7 +1098,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBaseUrlAndWebrootWithBaseUrl() {
|
public function testBaseUrlAndWebrootWithBaseUrl() {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
|
|
||||||
Configure::write('App.dir', 'app');
|
Configure::write('App.dir', 'app');
|
||||||
|
|
||||||
|
@ -1170,7 +1167,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBaseUrlAndWebrootWithBase() {
|
public function testBaseUrlAndWebrootWithBase() {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$Dispatcher->base = '/app';
|
$Dispatcher->base = '/app';
|
||||||
$result = $Dispatcher->baseUrl();
|
$result = $Dispatcher->baseUrl();
|
||||||
$expected = '/app';
|
$expected = '/app';
|
||||||
|
@ -1200,7 +1197,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testMissingController() {
|
public function testMissingController() {
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('App.baseUrl', '/index.php');
|
Configure::write('App.baseUrl', '/index.php');
|
||||||
$url = 'some_controller/home/param:value/param2:value2';
|
$url = 'some_controller/home/param:value/param2:value2';
|
||||||
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
||||||
|
@ -1219,7 +1216,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testPrivate() {
|
public function testPrivate() {
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('App.baseUrl','/index.php');
|
Configure::write('App.baseUrl','/index.php');
|
||||||
$url = 'some_pages/_protected/param:value/param2:value2';
|
$url = 'some_pages/_protected/param:value/param2:value2';
|
||||||
|
|
||||||
|
@ -1241,7 +1238,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testMissingAction() {
|
public function testMissingAction() {
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('App.baseUrl', '/index.php');
|
Configure::write('App.baseUrl', '/index.php');
|
||||||
$url = 'some_pages/home/param:value/param2:value2';
|
$url = 'some_pages/home/param:value/param2:value2';
|
||||||
|
|
||||||
|
@ -1256,7 +1253,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
)));
|
)));
|
||||||
$this->assertEqual($expected, $controller);
|
$this->assertEqual($expected, $controller);
|
||||||
|
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('App.baseUrl','/index.php');
|
Configure::write('App.baseUrl','/index.php');
|
||||||
$url = 'some_pages/redirect/param:value/param2:value2';
|
$url = 'some_pages/redirect/param:value/param2:value2';
|
||||||
|
|
||||||
|
@ -1278,7 +1275,10 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDispatch() {
|
public function testDispatch() {
|
||||||
$Dispatcher =& new TestDispatcher();
|
App::build(array(
|
||||||
|
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||||
|
));
|
||||||
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('App.baseUrl','/index.php');
|
Configure::write('App.baseUrl','/index.php');
|
||||||
$url = 'pages/home/param:value/param2:value2';
|
$url = 'pages/home/param:value/param2:value2';
|
||||||
|
|
||||||
|
@ -1307,7 +1307,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
|
|
||||||
unset($Dispatcher);
|
unset($Dispatcher);
|
||||||
|
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('App.baseUrl','/timesheets/index.php');
|
Configure::write('App.baseUrl','/timesheets/index.php');
|
||||||
|
|
||||||
$url = 'timesheets';
|
$url = 'timesheets';
|
||||||
|
@ -1339,7 +1339,10 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDispatchWithArray() {
|
public function testDispatchWithArray() {
|
||||||
$Dispatcher =& new TestDispatcher();
|
App::build(array(
|
||||||
|
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||||
|
));
|
||||||
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('App.baseUrl','/index.php');
|
Configure::write('App.baseUrl','/index.php');
|
||||||
$url = 'pages/home/param:value/param2:value2';
|
$url = 'pages/home/param:value/param2:value2';
|
||||||
|
|
||||||
|
@ -1359,13 +1362,13 @@ class DispatcherTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testAdminDispatch() {
|
public function testAdminDispatch() {
|
||||||
$_POST = array();
|
$_POST = array();
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('Routing.prefixes', array('admin'));
|
Configure::write('Routing.prefixes', array('admin'));
|
||||||
Configure::write('App.baseUrl','/cake/repo/branches/1.2.x.x/index.php');
|
Configure::write('App.baseUrl','/cake/repo/branches/1.2.x.x/index.php');
|
||||||
$url = 'admin/test_dispatch_pages/index/param:value/param2:value2';
|
$url = 'admin/test_dispatch_pages/index/param:value/param2:value2';
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Router =& Router::getInstance();
|
$Router = Router::getInstance();
|
||||||
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
||||||
|
|
||||||
$this->assertEqual($controller->name, 'TestDispatchPages');
|
$this->assertEqual($controller->name, 'TestDispatchPages');
|
||||||
|
@ -1390,7 +1393,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Router::connect(
|
Router::connect(
|
||||||
'/my_plugin/:controller/*',
|
'/my_plugin/:controller/*',
|
||||||
array('plugin' => 'my_plugin', 'controller' => 'pages', 'action' => 'display')
|
array('plugin' => 'my_plugin', 'controller' => 'pages', 'action' => 'display')
|
||||||
|
@ -1404,7 +1407,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'pass' => array('home'),
|
'pass' => array('home'),
|
||||||
'named' => array('param'=> 'value', 'param2'=> 'value2'), 'plugin'=> 'my_plugin',
|
'named' => array('param'=> 'value', 'param2'=> 'value2'), 'plugin'=> 'my_plugin',
|
||||||
'controller'=> 'some_pages', 'action'=> 'display', 'form'=> null,
|
'controller'=> 'some_pages', 'action'=> 'display', 'form'=> array(),
|
||||||
'url'=> array('url'=> 'my_plugin/some_pages/home/param:value/param2:value2'),
|
'url'=> array('url'=> 'my_plugin/some_pages/home/param:value/param2:value2'),
|
||||||
);
|
);
|
||||||
ksort($expected);
|
ksort($expected);
|
||||||
|
@ -1434,7 +1437,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Router::connect(
|
Router::connect(
|
||||||
'/my_plugin/:controller/:action/*',
|
'/my_plugin/:controller/:action/*',
|
||||||
array('plugin' => 'my_plugin', 'controller' => 'pages', 'action' => 'display')
|
array('plugin' => 'my_plugin', 'controller' => 'pages', 'action' => 'display')
|
||||||
|
@ -1473,7 +1476,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
App::setObjects('plugin', $plugins);
|
App::setObjects('plugin', $plugins);
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
||||||
$url = 'my_plugin/my_plugin/add/param:value/param2:value2';
|
$url = 'my_plugin/my_plugin/add/param:value/param2:value2';
|
||||||
|
@ -1487,7 +1490,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
|
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
||||||
// Simulates the Route for a real plugin, installed in APP/plugins
|
// Simulates the Route for a real plugin, installed in APP/plugins
|
||||||
|
@ -1509,7 +1512,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
Configure::write('Routing.prefixes', array('admin'));
|
Configure::write('Routing.prefixes', array('admin'));
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
||||||
$url = 'admin/my_plugin/my_plugin/add/5/param:value/param2:value2';
|
$url = 'admin/my_plugin/my_plugin/add/5/param:value/param2:value2';
|
||||||
|
@ -1530,7 +1533,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
Configure::write('Routing.prefixes', array('admin'));
|
Configure::write('Routing.prefixes', array('admin'));
|
||||||
Router::reload();
|
Router::reload();
|
||||||
|
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
||||||
$controller = $Dispatcher->dispatch('admin/articles_test', array('return' => 1));
|
$controller = $Dispatcher->dispatch('admin/articles_test', array('return' => 1));
|
||||||
|
@ -1568,7 +1571,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
App::setObjects('plugin', $plugins);
|
App::setObjects('plugin', $plugins);
|
||||||
Router::reload();
|
Router::reload();
|
||||||
|
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
||||||
$url = 'my_plugin/';
|
$url = 'my_plugin/';
|
||||||
|
@ -1596,7 +1599,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
), true);
|
), true);
|
||||||
App::objects('plugin', null, false);
|
App::objects('plugin', null, false);
|
||||||
|
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
||||||
$url = 'test_plugin/';
|
$url = 'test_plugin/';
|
||||||
|
@ -1633,7 +1636,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
||||||
$url = 'my_plugin/not_here/param:value/param2:value2';
|
$url = 'my_plugin/not_here/param:value/param2:value2';
|
||||||
|
@ -1649,7 +1652,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$this->assertIdentical($expected, $controller);
|
$this->assertIdentical($expected, $controller);
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
||||||
$url = 'my_plugin/param:value/param2:value2';
|
$url = 'my_plugin/param:value/param2:value2';
|
||||||
|
@ -1677,7 +1680,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
Router::reload();
|
Router::reload();
|
||||||
Router::connect('/admin/:controller/:action/*', array('prefix'=>'admin'), array('controller', 'action'));
|
Router::connect('/admin/:controller/:action/*', array('prefix'=>'admin'), array('controller', 'action'));
|
||||||
|
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
||||||
$url = 'test_dispatch_pages/admin_index/param:value/param2:value2';
|
$url = 'test_dispatch_pages/admin_index/param:value/param2:value2';
|
||||||
|
@ -1699,7 +1702,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testTestPluginDispatch() {
|
public function testTestPluginDispatch() {
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||||
));
|
));
|
||||||
|
@ -1728,7 +1731,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testChangingParamsFromBeforeFilter() {
|
public function testChangingParamsFromBeforeFilter() {
|
||||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$url = 'some_posts/index/param:value/param2:value2';
|
$url = 'some_posts/index/param:value/param2:value2';
|
||||||
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
||||||
|
|
||||||
|
@ -1761,7 +1764,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testAssets() {
|
public function testAssets() {
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Configure =& Configure::getInstance();
|
$Configure = Configure::getInstance();
|
||||||
$Configure->__objects = null;
|
$Configure->__objects = null;
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
|
@ -1770,19 +1773,19 @@ class DispatcherTest extends CakeTestCase {
|
||||||
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||||
));
|
));
|
||||||
|
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
$debug = Configure::read('debug');
|
$debug = Configure::read('debug');
|
||||||
Configure::write('debug', 0);
|
Configure::write('debug', 0);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$Dispatcher->dispatch('theme/test_theme/../webroot/css/test_asset.css');
|
$Dispatcher->dispatch('theme/test_theme/../webroot/css/test_asset.css');
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertFalse($result);
|
$this->assertEquals($result, '');
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$Dispatcher->dispatch('theme/test_theme/pdfs');
|
$Dispatcher->dispatch('theme/test_theme/pdfs');
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertFalse($result);
|
$this->assertEquals($result, '');
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$Dispatcher->dispatch('theme/test_theme/flash/theme_test.swf');
|
$Dispatcher->dispatch('theme/test_theme/flash/theme_test.swf');
|
||||||
|
@ -1904,7 +1907,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testMissingAssetProcessor404() {
|
function testMissingAssetProcessor404() {
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('Asset.filter', array(
|
Configure::write('Asset.filter', array(
|
||||||
'js' => '',
|
'js' => '',
|
||||||
'css' => null
|
'css' => null
|
||||||
|
@ -1925,7 +1928,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testAssetFilterForThemeAndPlugins() {
|
function testAssetFilterForThemeAndPlugins() {
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Configure::write('Asset.filter', array(
|
Configure::write('Asset.filter', array(
|
||||||
'js' => '',
|
'js' => '',
|
||||||
'css' => ''
|
'css' => ''
|
||||||
|
@ -1973,7 +1976,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS),
|
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS),
|
||||||
), true);
|
), true);
|
||||||
|
|
||||||
$dispatcher =& new TestDispatcher();
|
$dispatcher = new TestDispatcher();
|
||||||
$dispatcher->base = false;
|
$dispatcher->base = false;
|
||||||
|
|
||||||
$url = '/';
|
$url = '/';
|
||||||
|
@ -2107,7 +2110,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||||
));
|
));
|
||||||
|
|
||||||
$dispatcher =& new TestDispatcher();
|
$dispatcher = new TestDispatcher();
|
||||||
$dispatcher->base = false;
|
$dispatcher->base = false;
|
||||||
|
|
||||||
$url = 'test_cached_pages/cache_form';
|
$url = 'test_cached_pages/cache_form';
|
||||||
|
@ -2141,7 +2144,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
Router::mapResources('Posts');
|
Router::mapResources('Posts');
|
||||||
|
|
||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$dispatcher =& new Dispatcher();
|
$dispatcher = new Dispatcher();
|
||||||
$dispatcher->base = false;
|
$dispatcher->base = false;
|
||||||
|
|
||||||
$result = $dispatcher->parseParams('/posts');
|
$result = $dispatcher->parseParams('/posts');
|
||||||
|
@ -2195,7 +2198,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
"/index.php/%22%3E%3Ch1%20onclick=%22alert('xss');%22%3Eheya%3C/h1%3E"
|
"/index.php/%22%3E%3Ch1%20onclick=%22alert('xss');%22%3Eheya%3C/h1%3E"
|
||||||
);
|
);
|
||||||
|
|
||||||
$dispatcher =& new Dispatcher();
|
$dispatcher = new Dispatcher();
|
||||||
$result = $dispatcher->baseUrl();
|
$result = $dispatcher->baseUrl();
|
||||||
$expected = '/index.php/h1 onclick=alert(xss);heya';
|
$expected = '/index.php/h1 onclick=alert(xss);heya';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
@ -2207,7 +2210,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEnvironmentDetection() {
|
public function testEnvironmentDetection() {
|
||||||
$dispatcher =& new Dispatcher();
|
$dispatcher = new Dispatcher();
|
||||||
|
|
||||||
$environments = array(
|
$environments = array(
|
||||||
'IIS' => array(
|
'IIS' => array(
|
||||||
|
@ -2316,7 +2319,7 @@ class DispatcherTest extends CakeTestCase {
|
||||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher = new TestDispatcher();
|
||||||
Router::connect('/myalias/:action/*', array('controller' => 'my_controller', 'action' => null));
|
Router::connect('/myalias/:action/*', array('controller' => 'my_controller', 'action' => null));
|
||||||
|
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
<h2>Sweet, "Test App" got Baked by CakePHP!</h2>
|
<h2>Sweet, "Test App" got Baked by CakePHP!</h2>
|
||||||
|
|
||||||
<?php
|
|
||||||
if (Configure::read() > 0):
|
|
||||||
Debugger::checkSecurityKeys();
|
|
||||||
endif;
|
|
||||||
?>
|
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
if (is_writable(TMP)):
|
if (is_writable(TMP)):
|
||||||
|
@ -20,7 +14,7 @@ endif;
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
$settings = Cache::settings();
|
$settings = array();
|
||||||
if (!empty($settings)):
|
if (!empty($settings)):
|
||||||
echo '<span class="notice success">';
|
echo '<span class="notice success">';
|
||||||
printf(__('The %s is being used for caching. To change the config edit APP/config/core.php '), '<em>'. $settings['engine'] . 'Engine</em>');
|
printf(__('The %s is being used for caching. To change the config edit APP/config/core.php '), '<em>'. $settings['engine'] . 'Engine</em>');
|
||||||
|
@ -54,12 +48,10 @@ if (!empty($filePresent)):
|
||||||
if (!class_exists('ConnectionManager')) {
|
if (!class_exists('ConnectionManager')) {
|
||||||
require LIBS . 'model' . DS . 'connection_manager.php';
|
require LIBS . 'model' . DS . 'connection_manager.php';
|
||||||
}
|
}
|
||||||
$db = ConnectionManager::getInstance();
|
|
||||||
$connected = $db->getDataSource('default');
|
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
if ($connected->isConnected()):
|
if (true):
|
||||||
echo '<span class="notice success">';
|
echo '<span class="notice success">';
|
||||||
echo __('Cake is able to connect to the database.');
|
echo __('Cake is able to connect to the database.');
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
|
|
Loading…
Reference in a new issue