-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed
Description
- Laravel Version: 5.4.13
- PHP Version: 7.1.1
Description:
The commit 544faac changed ControllerDispatcher::resolveMethodDependencies in a breaking way. It previously kept the array keys, and replaced values in-place for method dependencies. It was changed so that it will now build a new array, without keeping the previous keys.
I am using the previous behavior (and the keys) to reorder the array in Controller::callAction to allow the methods to have another order of parameters than the order of the route segments, provided they have the same name.
Test To Reproduce:
use Illuminate\Routing\ControllerDispatcher;
class ControllerDispatcherTest extends \Illuminate\Foundation\Testing\TestCase {
use CreatesApplication;
public function testResolveMethodDependencies() {
$parameters = array(
'locale' => 'tlh'
);
$target = new ReflectionMethod(self::class, 'testResolveMethodDependencies_Target');
$controllerDispatcher = new ControllerDispatcher($this->app);
$actual = $controllerDispatcher->resolveMethodDependencies($parameters, $target);
$expected = array(
'locale' => 'tlh'
);
$this->assertEquals($expected, $actual);
}
protected function testResolveMethodDependencies_Target($locale) {
}
}
5.4.13 result:
1) ControllerDispatcherTest::testResolveMethodDependencies
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
- 'locale' => 'tlh'
+ 0 => 'tlh'
)
Metadata
Metadata
Assignees
Labels
No labels