Skip to content
Permalink
Browse files

enable PluginDot for routeClass parameter

  • Loading branch information...
rchavik committed Sep 12, 2012
1 parent 99b798f commit 0cae19a14e089f49285d600098c5238bb1941f12
@@ -304,7 +304,12 @@ public static function connect($route, $defaults = array(), $options = array())
}
$routeClass = self::$_routeClass;
if (isset($options['routeClass'])) {
$routeClass = self::_validateRouteClass($options['routeClass']);
if (strpos($options['routeClass'], '.') === false) {
$routeClass = $options['routeClass'];
} else {
list($plugin, $routeClass) = pluginSplit($options['routeClass'], true);
}
$routeClass = self::_validateRouteClass($routeClass);
unset($options['routeClass']);
}
if ($routeClass == 'RedirectRoute' && isset($defaults['redirect'])) {
@@ -2282,6 +2282,26 @@ public function testUsingCustomRouteClass() {
$this->assertEquals($expected, $result);
}
/**
* test using custom route class in PluginDot notation
*/
public function testUsingCustomRouteClassPluginDotSyntax() {
App::build(array(
'Plugin' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS
)
));
CakePlugin::load('TestPlugin');
App::uses('TestRoute', 'TestPlugin.Routing/Route');
$routes = Router::connect(
'/:slug',
array('controller' => 'posts', 'action' => 'view'),
array('routeClass' => 'TestPlugin.TestRoute', 'slug' => '[a-z_-]+')
);
$this->assertInstanceOf('TestRoute', $routes[0]);
CakePlugin::unload('TestPlugin');
}
/**
* test that route classes must extend CakeRoute
*
@@ -0,0 +1,7 @@
<?php
App::uses('CakeRoute', 'Routing/Route');
class TestRoute extends CakeRoute {
}

0 comments on commit 0cae19a

Please sign in to comment.
You can’t perform that action at this time.