/**
  * Test getting named routes.
  *
  * @return void
  */
 public function testNamed()
 {
     $routes = new RouteBuilder($this->collection, '/l');
     $routes->connect('/:controller', ['action' => 'index'], ['_name' => 'cntrl']);
     $routes->connect('/:controller/:action/*');
     $all = $this->collection->named();
     $this->assertCount(1, $all);
     $this->assertInstanceOf('Cake\\Routing\\Route\\Route', $all['cntrl']);
     $this->assertEquals('/l/:controller', $all['cntrl']->template);
 }
 /**
  * Test using name prefixes.
  *
  * @return void
  */
 public function testNamePrefixes()
 {
     $routes = new RouteBuilder($this->collection, '/api', [], ['namePrefix' => 'api:']);
     $routes->scope('/v1', ['version' => 1, '_namePrefix' => 'v1:'], function ($routes) {
         $this->assertEquals('api:v1:', $routes->namePrefix());
         $routes->connect('/ping', ['controller' => 'Pings'], ['_name' => 'ping']);
         $routes->namePrefix('web:');
         $routes->connect('/pong', ['controller' => 'Pongs'], ['_name' => 'pong']);
     });
     $all = $this->collection->named();
     $this->assertArrayHasKey('api:v1:ping', $all);
     $this->assertArrayHasKey('web:pong', $all);
 }
 /**
  * Test conflicting parameters raises an exception.
  *
  * @expectedException \BadMethodCallException
  * @expectedExceptionMessage You cannot define routes that conflict with the scope.
  * @return void
  */
 public function testConnectConflictingParameters()
 {
     $routes = new RouteBuilder($this->collection, '/admin', ['prefix' => 'admin']);
     $routes->connect('/', ['prefix' => 'manager', 'controller' => 'Dashboard', 'action' => 'view']);
 }