|
|
@@ -591,7 +591,6 @@ class ControllerFactoryTest extends TestCase
|
|
|
*/
|
|
|
public function testInvokeInjectPassedParametersVariadic()
|
|
|
{
|
|
|
- $this->container->add(stdClass::class, json_decode('{"key":"value"}'));
|
|
|
$request = new ServerRequest([
|
|
|
'url' => 'test_plugin_three/dependencies/optionalDep',
|
|
|
'params' => [
|
|
|
@@ -608,4 +607,28 @@ class ControllerFactoryTest extends TestCase
|
|
|
$this->assertNotNull($data);
|
|
|
$this->assertSame(['one', 'two'], $data->args);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Test that routing parameters are passed into controller action using spread operator
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testInvokeInjectPassedParametersSpread()
|
|
|
+ {
|
|
|
+ $request = new ServerRequest([
|
|
|
+ 'url' => 'test_plugin_three/dependencies/optionalDep',
|
|
|
+ 'params' => [
|
|
|
+ 'plugin' => null,
|
|
|
+ 'controller' => 'Dependencies',
|
|
|
+ 'action' => 'spread',
|
|
|
+ 'pass' => ['one', 'two'],
|
|
|
+ ],
|
|
|
+ ]);
|
|
|
+ $controller = $this->factory->create($request);
|
|
|
+ $result = $this->factory->invoke($controller);
|
|
|
+ $data = json_decode((string)$result->getBody());
|
|
|
+
|
|
|
+ $this->assertNotNull($data);
|
|
|
+ $this->assertSame(['one', 'two'], $data->args);
|
|
|
+ }
|
|
|
}
|