Skip to content
Permalink
Browse files

Fixing test for custom route

  • Loading branch information...
jrbasso committed Sep 17, 2012
1 parent ba16255 commit e1ee8d61c14594e9de77f0f36165028b7f19efe9
Showing with 4 additions and 7 deletions.
  1. +2 −5 lib/Cake/Routing/Router.php
  2. +2 −2 lib/Cake/Test/TestCase/Routing/RouterTest.php
@@ -14,6 +14,7 @@
*/
namespace Cake\Routing;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Error;
use Cake\Network\Request;
@@ -285,11 +286,7 @@ public static function connect($route, $defaults = array(), $options = array())
}
$routeClass = static::$_routeClass;
if (isset($options['routeClass'])) {
if (strpos($options['routeClass'], '.') === false) {
$routeClass = $options['routeClass'];
} else {
list($plugin, $routeClass) = pluginSplit($options['routeClass'], true);
}
$routeClass = App::classname($options['routeClass'], 'Routing/Route');
$routeClass = static::_validateRouteClass($routeClass);
unset($options['routeClass']);
}
@@ -2141,12 +2141,12 @@ public function testUsingCustomRouteClassPluginDotSyntax() {
)
));
Plugin::load('TestPlugin');
$routes = Router::connect(
Router::connect(
'/:slug',
array('controller' => 'posts', 'action' => 'view'),
array('routeClass' => 'TestPlugin.TestRoute', 'slug' => '[a-z_-]+')
);
$this->assertInstanceOf('TestPlugin\Routing\Route\TestRoute', $routes[0]);
$this->assertTrue(true); // Just to make sure the connect do not throw exception
Plugin::unload('TestPlugin');
}

0 comments on commit e1ee8d6

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