mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing issues where paths added to build() would be appended into the search paths after the default paths.
Fixed issue where paths added with build() would be lost when calling build() again to change a different path type. Tests updated. Fixes #410
This commit is contained in:
parent
2e11f63bd4
commit
d20aa23711
2 changed files with 8 additions and 3 deletions
|
@ -683,11 +683,13 @@ class App extends Object {
|
|||
$merge = array_merge($merge, (array)$core[$type]);
|
||||
}
|
||||
|
||||
$_this->{$type} = $default;
|
||||
if (empty($_this->{$type}) || empty($paths)) {
|
||||
$_this->{$type} = $default;
|
||||
}
|
||||
|
||||
if (!empty($paths[$type])) {
|
||||
$path = array_flip(array_flip(array_merge(
|
||||
$_this->{$type}, (array)$paths[$type], $merge
|
||||
(array)$paths[$type], $_this->{$type}, $merge
|
||||
)));
|
||||
$_this->{$type} = array_values($path);
|
||||
} else {
|
||||
|
|
|
@ -323,8 +323,8 @@ class AppImportTest extends CakeTestCase {
|
|||
$new = App::path('models');
|
||||
|
||||
$expected = array(
|
||||
APP . 'models' . DS,
|
||||
'/path/to/models/',
|
||||
APP . 'models' . DS,
|
||||
APP,
|
||||
ROOT . DS . LIBS . 'model' . DS
|
||||
);
|
||||
|
@ -599,9 +599,12 @@ class AppImportTest extends CakeTestCase {
|
|||
App::build(array(
|
||||
'helpers' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'helpers' . DS)
|
||||
));
|
||||
App::build(array('vendors' => array(TEST_CAKE_CORE_INCLUDE_PATH)));
|
||||
$this->assertFalse(class_exists('BananaHelper'), 'BananaHelper exists, cannot test importing it.');
|
||||
App::import('Helper', 'Banana');
|
||||
$this->assertTrue(class_exists('BananaHelper'), 'BananaHelper was not loaded.');
|
||||
|
||||
App::build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue