mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing more tests that were failing post merge.
This commit is contained in:
parent
1e108748e9
commit
ceca179184
3 changed files with 17 additions and 8 deletions
|
@ -440,17 +440,24 @@ class Controller extends Object {
|
|||
$this->uses = array_flip($this->uses);
|
||||
array_unshift($this->uses, $plugin . $this->modelClass);
|
||||
}
|
||||
} elseif ($this->uses !== null || $this->uses !== false) {
|
||||
$this->_mergeVars(array('uses'), 'AppController', false);
|
||||
} elseif (
|
||||
($this->uses !== null || $this->uses !== false) &&
|
||||
is_array($this->uses) && !empty($appVars['uses'])
|
||||
) {
|
||||
$this->uses = array_merge($this->uses, array_diff($appVars['uses'], $this->uses));
|
||||
var_dump($this->uses);
|
||||
}
|
||||
$this->_mergeVars($merge, 'AppController', true);
|
||||
}
|
||||
|
||||
if ($pluginController && $pluginName != null) {
|
||||
$merge = array('components', 'helpers');
|
||||
|
||||
if ($this->uses !== null || $this->uses !== false) {
|
||||
$this->_mergeVars(array('uses'), $pluginController, false);
|
||||
$appVars = get_class_vars($pluginController);
|
||||
if (
|
||||
($this->uses !== null || $this->uses !== false) &&
|
||||
is_array($this->uses) && !empty($appVars['uses'])
|
||||
) {
|
||||
$this->uses = array_merge($this->uses, array_diff($appVars['uses'], $this->uses));
|
||||
}
|
||||
$this->_mergeVars($merge, $pluginController);
|
||||
}
|
||||
|
|
|
@ -1283,13 +1283,14 @@ class ControllerTest extends CakeTestCase {
|
|||
? array_merge($appVars['uses'], $testVars['uses'])
|
||||
: $testVars['uses'];
|
||||
|
||||
$this->assertEqual(count(array_diff($TestController->helpers, $helpers)), 0);
|
||||
$this->assertEqual(count(array_diff_key($TestController->helpers, array_flip($helpers))), 0);
|
||||
$this->assertEqual(count(array_diff($TestController->uses, $uses)), 0);
|
||||
$this->assertEqual(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0);
|
||||
|
||||
$TestController = new AnotherTestController($request);
|
||||
$expected = array('ControllerComment', 'ControllerAlias', 'ControllerPost');
|
||||
$this->assertEqual($expected, $TestController->uses, '$uses was merged incorrectly, AppController models should be last.');
|
||||
$this->assertEquals($expected, $TestController->uses, '$uses was merged incorrectly, AppController models should be last.');
|
||||
|
||||
$TestController = new AnotherTestController($request);
|
||||
$TestController->constructClasses();
|
||||
|
||||
$appVars = get_class_vars('AppController');
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::import('Helper', 'Number');
|
||||
App::import('View', 'View');
|
||||
|
||||
/**
|
||||
* NumberHelperTest class
|
||||
|
|
Loading…
Reference in a new issue