mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding test for correct merge order for $uses.
Fixing incorrect merge ordering for $uses, so it matches historical behaviour. Fixes #1309
This commit is contained in:
parent
0e29567f8d
commit
4214242efd
2 changed files with 6 additions and 6 deletions
|
@ -437,9 +437,7 @@ class Controller extends Object {
|
|||
$this->{$var} = Set::merge($app, $normal);
|
||||
}
|
||||
} else {
|
||||
$this->{$var} = Set::merge(
|
||||
array_diff($appVars[$var], $this->{$var}), $this->{$var}
|
||||
);
|
||||
$this->{$var} = array_merge($this->{$var}, array_diff($appVars[$var], $this->{$var}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,9 +461,7 @@ class Controller extends Object {
|
|||
$this->{$var} = Set::merge($app, $normal);
|
||||
}
|
||||
} else {
|
||||
$this->{$var} = Set::merge(
|
||||
array_diff($appVars[$var], $this->{$var}), $this->{$var}
|
||||
);
|
||||
$this->{$var} = array_merge($this->{$var}, array_diff($appVars[$var], $this->{$var}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1153,6 +1153,10 @@ class ControllerTest extends CakeTestCase {
|
|||
$this->assertEqual(count(array_diff($TestController->uses, $uses)), 0);
|
||||
$this->assertEqual(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0);
|
||||
|
||||
$expected = array('ControllerComment', 'ControllerAlias', 'ControllerPost');
|
||||
$this->assertEqual($expected, $TestController->uses, '$uses was merged incorrectly, AppController models should be last.');
|
||||
|
||||
|
||||
$TestController =& new AnotherTestController();
|
||||
$TestController->constructClasses();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue