Skip to content
Permalink
Browse files

Convert to using ::class in RouteBuilder tests.

Refs #9633
  • Loading branch information...
markstory committed Nov 8, 2016
1 parent 9004f6b commit 469d827ca12a6862eadab7e2e1f45d2fcd8dc37c
Showing with 15 additions and 12 deletions.
  1. +15 −12 tests/TestCase/Routing/RouteBuilderTest.php
@@ -16,8 +16,11 @@
use Cake\Routing\RouteBuilder;
use Cake\Routing\RouteCollection;
use Cake\Routing\Router;
use Cake\Routing\Route\DashedRoute;
use Cake\Routing\Route\InflectedRoute;
use Cake\Routing\Route\RedirectRoute;
use Cake\Routing\Route\Route;
use Cake\Routing\Router;
use Cake\TestSuite\TestCase;
/**
@@ -81,8 +84,8 @@ public function testRoutes()
$all = $this->collection->routes();
$this->assertCount(2, $all);
$this->assertInstanceOf('Cake\Routing\Route\Route', $all[0]);
$this->assertInstanceOf('Cake\Routing\Route\Route', $all[1]);
$this->assertInstanceOf(Route::class, $all[0]);
$this->assertInstanceOf(Route::class, $all[1]);
}
/**
@@ -102,8 +105,8 @@ public function testRouteClass()
$routes->connect('/:controller/:action/*');
$all = $this->collection->routes();
$this->assertInstanceOf('Cake\Routing\Route\InflectedRoute', $all[0]);
$this->assertInstanceOf('Cake\Routing\Route\InflectedRoute', $all[1]);
$this->assertInstanceOf(InflectedRoute::class, $all[0]);
$this->assertInstanceOf(InflectedRoute::class, $all[1]);
$this->collection = new RouteCollection();
$routes = new RouteBuilder($this->collection, '/l');
@@ -142,7 +145,7 @@ public function testConnectBasic()
$this->assertNull($routes->connect('/:controller'));
$route = $this->collection->routes()[0];
$this->assertInstanceOf('Cake\Routing\Route\Route', $route);
$this->assertInstanceOf(Route::class, $route);
$this->assertEquals('/l/:controller', $route->template);
$expected = ['prefix' => 'api', 'action' => 'index', 'plugin' => null];
$this->assertEquals($expected, $route->defaults);
@@ -289,12 +292,12 @@ public function testRedirect()
$routes->redirect('/p/:id', ['controller' => 'posts', 'action' => 'view'], ['status' => 301]);
$route = $this->collection->routes()[0];
$this->assertInstanceOf('Cake\Routing\Route\RedirectRoute', $route);
$this->assertInstanceOf(RedirectRoute::class, $route);
$routes->redirect('/old', '/forums', ['status' => 301]);
$route = $this->collection->routes()[1];
$this->assertInstanceOf('Cake\Routing\Route\RedirectRoute', $route);
$this->assertInstanceOf(RedirectRoute::class, $route);
$this->assertEquals('/forums', $route->redirect[0]);
}
@@ -307,7 +310,7 @@ public function testPrefix()
{
$routes = new RouteBuilder($this->collection, '/path', ['key' => 'value']);
$res = $routes->prefix('admin', ['param' => 'value'], function ($r) {
$this->assertInstanceOf('Cake\Routing\RouteBuilder', $r);
$this->assertInstanceOf(RouteBuilder::class, $r);
$this->assertCount(0, $this->collection->routes());
$this->assertEquals('/path/admin', $r->path());
$this->assertEquals(['prefix' => 'admin', 'key' => 'value', 'param' => 'value'], $r->params());
@@ -324,7 +327,7 @@ public function testPrefixWithNoParams()
{
$routes = new RouteBuilder($this->collection, '/path', ['key' => 'value']);
$res = $routes->prefix('admin', function ($r) {
$this->assertInstanceOf('Cake\Routing\RouteBuilder', $r);
$this->assertInstanceOf(RouteBuilder::class, $r);
$this->assertCount(0, $this->collection->routes());
$this->assertEquals('/path/admin', $r->path());
$this->assertEquals(['prefix' => 'admin', 'key' => 'value'], $r->params());
@@ -680,7 +683,7 @@ public function testFallbacks()
$all = $this->collection->routes();
$this->assertEquals('/api/:controller', $all[0]->template);
$this->assertEquals('/api/:controller/:action/*', $all[1]->template);
$this->assertInstanceOf('Cake\Routing\Route\Route', $all[0]);
$this->assertInstanceOf(Route::class, $all[0]);
}
/**
@@ -696,7 +699,7 @@ public function testFallbacksWithClass()
$all = $this->collection->routes();
$this->assertEquals('/api/:controller', $all[0]->template);
$this->assertEquals('/api/:controller/:action/*', $all[1]->template);
$this->assertInstanceOf('Cake\Routing\Route\InflectedRoute', $all[0]);
$this->assertInstanceOf(InflectedRoute::class, $all[0]);
}
/**

0 comments on commit 469d827

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