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