Skip to content

Commit be86501

Browse files
committed
Merge branch '4.4' into 5.3
* 4.4: Add test for non-callable arrays as controllers
2 parents 1241a00 + 9ddf033 commit be86501

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

Loader/Configurator/Traits/RouteTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ final public function methods(array $methods): self
126126
/**
127127
* Adds the "_controller" entry to defaults.
128128
*
129-
* @param callable|string $controller a callable or parseable pseudo-callable
129+
* @param callable|string|array $controller a callable or parseable pseudo-callable
130130
*
131131
* @return $this
132132
*/

Tests/Fixtures/php_dsl.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
->options(['utf8' => true])
1111
->add('buz', 'zub')
1212
->controller('foo:act')
13-
->stateless(true);
13+
->stateless(true)
14+
->add('controller_class', '/controller')
15+
->controller(['Acme\MyApp\MyController', 'myAction']);
1416

1517
$routes->import('php_dsl_sub.php')
1618
->prefix('/sub')

Tests/Fixtures/php_object_dsl.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ public function __invoke(RoutingConfigurator $routes)
1212
->options(['utf8' => true])
1313
->add('buz', 'zub')
1414
->controller('foo:act')
15-
->stateless(true);
15+
->stateless(true)
16+
->add('controller_class', '/controller')
17+
->controller(['Acme\MyApp\MyController', 'myAction']);
1618

1719
$routes->import('php_dsl_sub.php')
1820
->prefix('/sub')

Tests/Loader/PhpFileLoaderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ public function testRoutingConfigurator()
177177
$expectedCollection->add('buz', (new Route('/zub'))
178178
->setDefaults(['_controller' => 'foo:act', '_stateless' => true])
179179
);
180+
$expectedCollection->add('controller_class', (new Route('/controller'))
181+
->setDefaults(['_controller' => ['Acme\MyApp\MyController', 'myAction']])
182+
);
180183
$expectedCollection->add('c_root', (new Route('/sub/pub/'))
181184
->setRequirements(['id' => '\d+'])
182185
);

0 commit comments

Comments
 (0)