mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +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);
|
$this->uses = array_flip($this->uses);
|
||||||
array_unshift($this->uses, $plugin . $this->modelClass);
|
array_unshift($this->uses, $plugin . $this->modelClass);
|
||||||
}
|
}
|
||||||
} elseif ($this->uses !== null || $this->uses !== false) {
|
} elseif (
|
||||||
$this->_mergeVars(array('uses'), 'AppController', false);
|
($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);
|
$this->_mergeVars($merge, 'AppController', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pluginController && $pluginName != null) {
|
if ($pluginController && $pluginName != null) {
|
||||||
$merge = array('components', 'helpers');
|
$merge = array('components', 'helpers');
|
||||||
|
$appVars = get_class_vars($pluginController);
|
||||||
if ($this->uses !== null || $this->uses !== false) {
|
if (
|
||||||
$this->_mergeVars(array('uses'), $pluginController, false);
|
($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);
|
$this->_mergeVars($merge, $pluginController);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1283,13 +1283,14 @@ class ControllerTest extends CakeTestCase {
|
||||||
? array_merge($appVars['uses'], $testVars['uses'])
|
? array_merge($appVars['uses'], $testVars['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($TestController->uses, $uses)), 0);
|
||||||
$this->assertEqual(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0);
|
$this->assertEqual(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0);
|
||||||
|
|
||||||
$TestController = new AnotherTestController($request);
|
|
||||||
$expected = array('ControllerComment', 'ControllerAlias', 'ControllerPost');
|
$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();
|
$TestController->constructClasses();
|
||||||
|
|
||||||
$appVars = get_class_vars('AppController');
|
$appVars = get_class_vars('AppController');
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Helper', 'Number');
|
App::import('Helper', 'Number');
|
||||||
|
App::import('View', 'View');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NumberHelperTest class
|
* NumberHelperTest class
|
||||||
|
|
Loading…
Reference in a new issue