mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 08:58:25 +00:00
Making more tests no longer skip in test suites.
This commit is contained in:
parent
95f58321a8
commit
42754c63ff
1 changed files with 38 additions and 47 deletions
|
@ -22,46 +22,38 @@ App::import('Core', array('CakeRequest', 'CakeResponse'));
|
|||
App::import('Component', 'Security');
|
||||
App::import('Component', 'Cookie');
|
||||
|
||||
|
||||
/**
|
||||
* AppController class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
if (!class_exists('AppController')) {
|
||||
/**
|
||||
* AppController class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class AppController extends Controller {
|
||||
/**
|
||||
class ControllerTestAppController extends Controller {
|
||||
/**
|
||||
* helpers property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $helpers = array('Html');
|
||||
/**
|
||||
/**
|
||||
* uses property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $uses = array('ControllerPost');
|
||||
/**
|
||||
/**
|
||||
* components property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $components = array('Cookie');
|
||||
}
|
||||
} elseif (!defined('APP_CONTROLLER_EXISTS')) {
|
||||
define('APP_CONTROLLER_EXISTS', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ControllerPost class
|
||||
*
|
||||
|
@ -137,7 +129,7 @@ class ControllerPost extends CakeTestModel {
|
|||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ControllerCommentsController extends AppController {
|
||||
class ControllerCommentsController extends ControllerTestAppController {
|
||||
|
||||
/**
|
||||
* name property
|
||||
|
@ -146,6 +138,8 @@ class ControllerCommentsController extends AppController {
|
|||
* @access public
|
||||
*/
|
||||
public $name = 'ControllerComments';
|
||||
|
||||
protected $_mergeParent = 'ControllerTestAppController';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -259,7 +253,7 @@ class NameTest extends CakeTestModel {
|
|||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class TestController extends AppController {
|
||||
class TestController extends ControllerTestAppController {
|
||||
|
||||
/**
|
||||
* name property
|
||||
|
@ -292,6 +286,8 @@ class TestController extends AppController {
|
|||
*/
|
||||
public $uses = array('ControllerComment', 'ControllerAlias');
|
||||
|
||||
protected $_mergeParent = 'ControllerTestAppController';
|
||||
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
|
@ -367,7 +363,7 @@ class TestComponent extends Object {
|
|||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class AnotherTestController extends AppController {
|
||||
class AnotherTestController extends ControllerTestAppController {
|
||||
|
||||
/**
|
||||
* name property
|
||||
|
@ -382,6 +378,8 @@ class AnotherTestController extends AppController {
|
|||
* @access public
|
||||
*/
|
||||
public $uses = null;
|
||||
|
||||
protected $_mergeParent = 'ControllerTestAppController';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -870,17 +868,13 @@ class ControllerTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testMergeVars() {
|
||||
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
|
||||
return;
|
||||
}
|
||||
$request = new CakeRequest('controller_posts/index');
|
||||
|
||||
|
||||
$TestController = new TestController($request);
|
||||
$TestController->constructClasses();
|
||||
|
||||
$testVars = get_class_vars('TestController');
|
||||
$appVars = get_class_vars('AppController');
|
||||
$appVars = get_class_vars('ControllerTestAppController');
|
||||
|
||||
$components = is_array($appVars['components'])
|
||||
? array_merge($appVars['components'], $testVars['components'])
|
||||
|
@ -900,12 +894,12 @@ class ControllerTest extends CakeTestCase {
|
|||
$this->assertEqual(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0);
|
||||
|
||||
$expected = array('ControllerComment', 'ControllerAlias', 'ControllerPost');
|
||||
$this->assertEquals($expected, $TestController->uses, '$uses was merged incorrectly, AppController models should be last.');
|
||||
$this->assertEquals($expected, $TestController->uses, '$uses was merged incorrectly, ControllerTestAppController models should be last.');
|
||||
|
||||
$TestController = new AnotherTestController($request);
|
||||
$TestController->constructClasses();
|
||||
|
||||
$appVars = get_class_vars('AppController');
|
||||
$appVars = get_class_vars('ControllerTestAppController');
|
||||
$testVars = get_class_vars('AnotherTestController');
|
||||
|
||||
|
||||
|
@ -918,7 +912,7 @@ class ControllerTest extends CakeTestCase {
|
|||
$TestController = new ControllerCommentsController($request);
|
||||
$TestController->constructClasses();
|
||||
|
||||
$appVars = get_class_vars('AppController');
|
||||
$appVars = get_class_vars('ControllerTestAppController');
|
||||
$testVars = get_class_vars('ControllerCommentsController');
|
||||
|
||||
|
||||
|
@ -936,9 +930,6 @@ class ControllerTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testChildComponentOptionsSupercedeParents() {
|
||||
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
|
||||
return;
|
||||
}
|
||||
$request = new CakeRequest('controller_posts/index');
|
||||
|
||||
$TestController = new TestController($request);
|
||||
|
@ -951,7 +942,7 @@ class ControllerTest extends CakeTestCase {
|
|||
|
||||
/**
|
||||
* Ensure that __mergeVars is not being greedy and merging with
|
||||
* AppController when you make an instance of Controller
|
||||
* ControllerTestAppController when you make an instance of Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue