Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding test for correct merge order for $uses.

Fixing incorrect merge ordering for $uses, so it matches historical behaviour.
Fixes #1309
  • Loading branch information...
commit 4214242efd05645db042524aa85a953acda152f8 1 parent 0e29567
@markstory markstory authored
View
8 cake/libs/controller/controller.php
@@ -437,9 +437,7 @@ function __mergeVars() {
$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 @@ function __mergeVars() {
$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}));
}
}
}
View
4 cake/tests/cases/libs/controller/controller.test.php
@@ -1153,6 +1153,10 @@ function testMergeVars() {
$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();
Please sign in to comment.
Something went wrong with that request. Please try again.