| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769 |
- <?php
- /**
- * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
- * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
- *
- * Licensed under The MIT License
- * For full copyright and license information, please see the LICENSE.txt
- * Redistributions of files must retain the above copyright notice.
- *
- * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
- * @link https://cakephp.org CakePHP(tm) Project
- * @since 3.0.0
- * @license https://opensource.org/licenses/mit-license.php MIT License
- */
- namespace Cake\Test\TestCase\Routing;
- use Cake\Http\ServerRequest;
- use Cake\Routing\Exception\MissingRouteException;
- use Cake\Routing\RouteBuilder;
- use Cake\Routing\RouteCollection;
- use Cake\Routing\Route\Route;
- use Cake\TestSuite\TestCase;
- class RouteCollectionTest extends TestCase
- {
- /**
- * Setup method
- *
- * @return void
- */
- public function setUp()
- {
- parent::setUp();
- $this->collection = new RouteCollection();
- }
- /**
- * Test parse() throws an error on unknown routes.
- *
- */
- public function testParseMissingRoute()
- {
- $this->expectException(\Cake\Routing\Exception\MissingRouteException::class);
- $this->expectExceptionMessage('A route matching "/" could not be found');
- $routes = new RouteBuilder($this->collection, '/b', ['key' => 'value']);
- $routes->connect('/', ['controller' => 'Articles']);
- $routes->connect('/:id', ['controller' => 'Articles', 'action' => 'view']);
- $result = $this->collection->parse('/');
- $this->assertEquals([], $result, 'Should not match, missing /b');
- }
- /**
- * Test parse() throws an error on known routes called with unknown methods.
- *
- */
- public function testParseMissingRouteMethod()
- {
- $this->expectException(\Cake\Routing\Exception\MissingRouteException::class);
- $this->expectExceptionMessage('A "POST" route matching "/b" could not be found');
- $routes = new RouteBuilder($this->collection, '/b', ['key' => 'value']);
- $routes->connect('/', ['controller' => 'Articles', '_method' => ['GET']]);
- $result = $this->collection->parse('/b', 'GET');
- $this->assertNotEmpty($result, 'Route should be found');
- $result = $this->collection->parse('/b', 'POST');
- $this->assertEquals([], $result, 'Should not match with missing method');
- }
- /**
- * Test parsing routes.
- *
- * @return void
- */
- public function testParse()
- {
- $routes = new RouteBuilder($this->collection, '/b', ['key' => 'value']);
- $routes->connect('/', ['controller' => 'Articles']);
- $routes->connect('/:id', ['controller' => 'Articles', 'action' => 'view']);
- $routes->connect('/media/search/*', ['controller' => 'Media', 'action' => 'search']);
- $result = $this->collection->parse('/b/');
- $expected = [
- 'controller' => 'Articles',
- 'action' => 'index',
- 'pass' => [],
- 'plugin' => null,
- 'key' => 'value',
- '_matchedRoute' => '/b',
- ];
- $this->assertEquals($expected, $result);
- $result = $this->collection->parse('/b/the-thing?one=two');
- $expected = [
- 'controller' => 'Articles',
- 'action' => 'view',
- 'id' => 'the-thing',
- 'pass' => [],
- 'plugin' => null,
- 'key' => 'value',
- '?' => ['one' => 'two'],
- '_matchedRoute' => '/b/:id',
- ];
- $this->assertEquals($expected, $result);
- $result = $this->collection->parse('/b/media/search');
- $expected = [
- 'key' => 'value',
- 'pass' => [],
- 'plugin' => null,
- 'controller' => 'Media',
- 'action' => 'search',
- '_matchedRoute' => '/b/media/search/*',
- ];
- $this->assertEquals($expected, $result);
- $result = $this->collection->parse('/b/media/search/thing');
- $expected = [
- 'key' => 'value',
- 'pass' => ['thing'],
- 'plugin' => null,
- 'controller' => 'Media',
- 'action' => 'search',
- '_matchedRoute' => '/b/media/search/*',
- ];
- $this->assertEquals($expected, $result);
- }
- /**
- * Test parsing routes with and without _name.
- *
- * @return void
- */
- public function testParseWithNameParameter()
- {
- $routes = new RouteBuilder($this->collection, '/b', ['key' => 'value']);
- $routes->connect('/', ['controller' => 'Articles']);
- $routes->connect('/:id', ['controller' => 'Articles', 'action' => 'view']);
- $routes->connect('/media/search/*', ['controller' => 'Media', 'action' => 'search'], ['_name' => 'media_search']);
- $result = $this->collection->parse('/b/');
- $expected = [
- 'controller' => 'Articles',
- 'action' => 'index',
- 'pass' => [],
- 'plugin' => null,
- 'key' => 'value',
- '_matchedRoute' => '/b',
- ];
- $this->assertEquals($expected, $result);
- $result = $this->collection->parse('/b/the-thing?one=two');
- $expected = [
- 'controller' => 'Articles',
- 'action' => 'view',
- 'id' => 'the-thing',
- 'pass' => [],
- 'plugin' => null,
- 'key' => 'value',
- '?' => ['one' => 'two'],
- '_matchedRoute' => '/b/:id',
- ];
- $this->assertEquals($expected, $result);
- $result = $this->collection->parse('/b/media/search');
- $expected = [
- 'key' => 'value',
- 'pass' => [],
- 'plugin' => null,
- 'controller' => 'Media',
- 'action' => 'search',
- '_matchedRoute' => '/b/media/search/*',
- '_name' => 'media_search',
- ];
- $this->assertEquals($expected, $result);
- $result = $this->collection->parse('/b/media/search/thing');
- $expected = [
- 'key' => 'value',
- 'pass' => ['thing'],
- 'plugin' => null,
- 'controller' => 'Media',
- 'action' => 'search',
- '_matchedRoute' => '/b/media/search/*',
- '_name' => 'media_search',
- ];
- $this->assertEquals($expected, $result);
- }
- /**
- * Test that parse decodes URL data before matching.
- * This is important for multibyte URLs that pass through URL rewriting.
- *
- * @return void
- */
- public function testParseEncodedBytesInFixedSegment()
- {
- $routes = new RouteBuilder($this->collection, '/');
- $routes->connect('/ден/:day-:month', ['controller' => 'Events', 'action' => 'index']);
- $url = '/%D0%B4%D0%B5%D0%BD/15-%D0%BE%D0%BA%D1%82%D0%BE%D0%BC%D0%B2%D1%80%D0%B8?test=foo';
- $result = $this->collection->parse($url);
- $expected = [
- 'pass' => [],
- 'plugin' => null,
- 'controller' => 'Events',
- 'action' => 'index',
- 'day' => '15',
- 'month' => 'октомври',
- '?' => ['test' => 'foo'],
- '_matchedRoute' => '/ден/:day-:month',
- ];
- $this->assertEquals($expected, $result);
- $request = new ServerRequest(['url' => $url]);
- $result = $this->collection->parseRequest($request);
- $this->assertEquals($expected, $result);
- }
- /**
- * Test that parsing checks all the related path scopes.
- *
- * @return void
- */
- public function testParseFallback()
- {
- $routes = new RouteBuilder($this->collection, '/', []);
- $routes->resources('Articles');
- $routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'InflectedRoute']);
- $routes->connect('/:controller/:action', [], ['routeClass' => 'InflectedRoute']);
- $result = $this->collection->parse('/articles/add');
- $expected = [
- 'controller' => 'Articles',
- 'action' => 'add',
- 'plugin' => null,
- 'pass' => [],
- '_matchedRoute' => '/:controller/:action',
- ];
- $this->assertEquals($expected, $result);
- }
- /**
- * Test parseRequest() throws an error on unknown routes.
- *
- */
- public function testParseRequestMissingRoute()
- {
- $this->expectException(\Cake\Routing\Exception\MissingRouteException::class);
- $this->expectExceptionMessage('A route matching "/" could not be found');
- $routes = new RouteBuilder($this->collection, '/b', ['key' => 'value']);
- $routes->connect('/', ['controller' => 'Articles']);
- $routes->connect('/:id', ['controller' => 'Articles', 'action' => 'view']);
- $request = new ServerRequest(['url' => '/']);
- $result = $this->collection->parseRequest($request);
- $this->assertEquals([], $result, 'Should not match, missing /b');
- }
- /**
- * Test parseRequest() checks host conditions
- *
- * @return void
- */
- public function testParseRequestCheckHostCondition()
- {
- $routes = new RouteBuilder($this->collection, '/');
- $routes->connect(
- '/fallback',
- ['controller' => 'Articles', 'action' => 'index'],
- ['_host' => '*.example.com']
- );
- $request = new ServerRequest([
- 'environment' => [
- 'HTTP_HOST' => 'a.example.com',
- 'PATH_INFO' => '/fallback',
- ],
- ]);
- $result = $this->collection->parseRequest($request);
- $expected = [
- 'controller' => 'Articles',
- 'action' => 'index',
- 'pass' => [],
- 'plugin' => null,
- '_matchedRoute' => '/fallback',
- ];
- $this->assertEquals($expected, $result, 'Should match, domain is correct');
- $request = new ServerRequest([
- 'environment' => [
- 'HTTP_HOST' => 'foo.bar.example.com',
- 'PATH_INFO' => '/fallback',
- ],
- ]);
- $result = $this->collection->parseRequest($request);
- $this->assertEquals($expected, $result, 'Should match, domain is a matching subdomain');
- $request = new ServerRequest([
- 'environment' => [
- 'HTTP_HOST' => 'example.test.com',
- 'PATH_INFO' => '/fallback',
- ],
- ]);
- try {
- $this->collection->parseRequest($request);
- $this->fail('No exception raised');
- } catch (MissingRouteException $e) {
- $this->assertContains('/fallback', $e->getMessage());
- }
- }
- /**
- * Get a list of hostnames
- *
- * @return array
- */
- public static function hostProvider()
- {
- return [
- ['wrong.example'],
- ['example.com'],
- ['aexample.com'],
- ];
- }
- /**
- * Test parseRequest() checks host conditions
- *
- * @dataProvider hostProvider
- */
- public function testParseRequestCheckHostConditionFail($host)
- {
- $this->expectException(\Cake\Routing\Exception\MissingRouteException::class);
- $this->expectExceptionMessage('A route matching "/fallback" could not be found');
- $routes = new RouteBuilder($this->collection, '/');
- $routes->connect(
- '/fallback',
- ['controller' => 'Articles', 'action' => 'index'],
- ['_host' => '*.example.com']
- );
- $request = new ServerRequest([
- 'environment' => [
- 'HTTP_HOST' => $host,
- 'PATH_INFO' => '/fallback',
- ],
- ]);
- $this->collection->parseRequest($request);
- }
- /**
- * Test parsing routes.
- *
- * @return void
- */
- public function testParseRequest()
- {
- $routes = new RouteBuilder($this->collection, '/b', ['key' => 'value']);
- $routes->connect('/', ['controller' => 'Articles']);
- $routes->connect('/:id', ['controller' => 'Articles', 'action' => 'view']);
- $routes->connect('/media/search/*', ['controller' => 'Media', 'action' => 'search']);
- $request = new ServerRequest(['url' => '/b/']);
- $result = $this->collection->parseRequest($request);
- $expected = [
- 'controller' => 'Articles',
- 'action' => 'index',
- 'pass' => [],
- 'plugin' => null,
- 'key' => 'value',
- '_matchedRoute' => '/b',
- ];
- $this->assertEquals($expected, $result);
- $request = new ServerRequest(['url' => '/b/media/search']);
- $result = $this->collection->parseRequest($request);
- $expected = [
- 'key' => 'value',
- 'pass' => [],
- 'plugin' => null,
- 'controller' => 'Media',
- 'action' => 'search',
- '_matchedRoute' => '/b/media/search/*',
- ];
- $this->assertEquals($expected, $result);
- $request = new ServerRequest(['url' => '/b/media/search/thing']);
- $result = $this->collection->parseRequest($request);
- $expected = [
- 'key' => 'value',
- 'pass' => ['thing'],
- 'plugin' => null,
- 'controller' => 'Media',
- 'action' => 'search',
- '_matchedRoute' => '/b/media/search/*',
- ];
- $this->assertEquals($expected, $result);
- $request = new ServerRequest(['url' => '/b/the-thing?one=two']);
- $result = $this->collection->parseRequest($request);
- $expected = [
- 'controller' => 'Articles',
- 'action' => 'view',
- 'id' => 'the-thing',
- 'pass' => [],
- 'plugin' => null,
- 'key' => 'value',
- '?' => ['one' => 'two'],
- '_matchedRoute' => '/b/:id',
- ];
- $this->assertEquals($expected, $result);
- }
- /**
- * Test parsing routes that match non-ascii urls
- *
- * @return void
- */
- public function testParseRequestUnicode()
- {
- $routes = new RouteBuilder($this->collection, '/b', []);
- $routes->connect('/alta/confirmación', ['controller' => 'Media', 'action' => 'confirm']);
- $request = new ServerRequest(['url' => '/b/alta/confirmaci%C3%B3n']);
- $result = $this->collection->parseRequest($request);
- $expected = [
- 'controller' => 'Media',
- 'action' => 'confirm',
- 'pass' => [],
- 'plugin' => null,
- '_matchedRoute' => '/b/alta/confirmación',
- ];
- $this->assertEquals($expected, $result);
- $request = new ServerRequest(['url' => '/b/alta/confirmación']);
- $result = $this->collection->parseRequest($request);
- $this->assertEquals($expected, $result);
- }
- /**
- * Test match() throws an error on unknown routes.
- *
- */
- public function testMatchError()
- {
- $this->expectException(\Cake\Routing\Exception\MissingRouteException::class);
- $this->expectExceptionMessage('A route matching "array (');
- $context = [
- '_base' => '/',
- '_scheme' => 'http',
- '_host' => 'example.org',
- ];
- $routes = new RouteBuilder($this->collection, '/b');
- $routes->connect('/', ['controller' => 'Articles']);
- $this->collection->match(['plugin' => null, 'controller' => 'Articles', 'action' => 'add'], $context);
- }
- /**
- * Test matching routes.
- *
- * @return void
- */
- public function testMatch()
- {
- $context = [
- '_base' => '/',
- '_scheme' => 'http',
- '_host' => 'example.org',
- ];
- $routes = new RouteBuilder($this->collection, '/b');
- $routes->connect('/', ['controller' => 'Articles']);
- $routes->connect('/:id', ['controller' => 'Articles', 'action' => 'view']);
- $result = $this->collection->match(['plugin' => null, 'controller' => 'Articles', 'action' => 'index'], $context);
- $this->assertEquals('b', $result);
- $result = $this->collection->match(
- ['id' => 'thing', 'plugin' => null, 'controller' => 'Articles', 'action' => 'view'],
- $context
- );
- $this->assertEquals('b/thing', $result);
- }
- /**
- * Test matching routes with names
- *
- * @return void
- */
- public function testMatchNamed()
- {
- $context = [
- '_base' => '/',
- '_scheme' => 'http',
- '_host' => 'example.org',
- ];
- $routes = new RouteBuilder($this->collection, '/b');
- $routes->connect('/', ['controller' => 'Articles']);
- $routes->connect('/:id', ['controller' => 'Articles', 'action' => 'view'], ['_name' => 'article:view']);
- $result = $this->collection->match(['_name' => 'article:view', 'id' => '2'], $context);
- $this->assertEquals('/b/2', $result);
- $result = $this->collection->match(['plugin' => null, 'controller' => 'Articles', 'action' => 'view', 'id' => '2'], $context);
- $this->assertEquals('b/2', $result);
- }
- /**
- * Test match() throws an error on named routes that fail to match
- *
- */
- public function testMatchNamedError()
- {
- $this->expectException(\Cake\Routing\Exception\MissingRouteException::class);
- $this->expectExceptionMessage('A named route was found for "fail", but matching failed');
- $context = [
- '_base' => '/',
- '_scheme' => 'http',
- '_host' => 'example.org',
- ];
- $routes = new RouteBuilder($this->collection, '/b');
- $routes->connect('/:lang/articles', ['controller' => 'Articles'], ['_name' => 'fail']);
- $this->collection->match(['_name' => 'fail'], $context);
- }
- /**
- * Test matching routes with names and failing
- *
- * @return void
- */
- public function testMatchNamedMissingError()
- {
- $this->expectException(\Cake\Routing\Exception\MissingRouteException::class);
- $context = [
- '_base' => '/',
- '_scheme' => 'http',
- '_host' => 'example.org',
- ];
- $routes = new RouteBuilder($this->collection, '/b');
- $routes->connect('/:id', ['controller' => 'Articles', 'action' => 'view'], ['_name' => 'article:view']);
- $this->collection->match(['_name' => 'derp'], $context);
- }
- /**
- * Test matching plugin routes.
- *
- * @return void
- */
- public function testMatchPlugin()
- {
- $context = [
- '_base' => '/',
- '_scheme' => 'http',
- '_host' => 'example.org',
- ];
- $routes = new RouteBuilder($this->collection, '/contacts', ['plugin' => 'Contacts']);
- $routes->connect('/', ['controller' => 'Contacts']);
- $result = $this->collection->match(['plugin' => 'Contacts', 'controller' => 'Contacts', 'action' => 'index'], $context);
- $this->assertEquals('contacts', $result);
- }
- /**
- * Test that prefixes increase the specificity of a route match.
- *
- * Connect the admin route after the non prefixed version, this means
- * the non-prefix route would have a more specific name (users:index)
- *
- * @return void
- */
- public function testMatchPrefixSpecificity()
- {
- $context = [
- '_base' => '/',
- '_scheme' => 'http',
- '_host' => 'example.org',
- ];
- $routes = new RouteBuilder($this->collection, '/');
- $routes->connect('/:action/*', ['controller' => 'Users']);
- $routes->connect('/admin/{controller}', ['prefix' => 'admin', 'action' => 'index']);
- $url = [
- 'plugin' => null,
- 'prefix' => 'admin',
- 'controller' => 'Users',
- 'action' => 'index',
- ];
- $result = $this->collection->match($url, $context);
- $this->assertEquals('admin/Users', $result);
- $url = [
- 'plugin' => null,
- 'controller' => 'Users',
- 'action' => 'index',
- ];
- $result = $this->collection->match($url, $context);
- $this->assertEquals('index', $result);
- }
- /**
- * 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 the add() and routes() method.
- *
- * @return void
- */
- public function testAddingRoutes()
- {
- $one = new Route('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
- $two = new Route('/', ['controller' => 'Dashboards', 'action' => 'display']);
- $this->collection->add($one);
- $this->collection->add($two);
- $routes = $this->collection->routes();
- $this->assertCount(2, $routes);
- $this->assertSame($one, $routes[0]);
- $this->assertSame($two, $routes[1]);
- }
- /**
- * Test the add() with some _name.
- *
- *
- * @return void
- */
- public function testAddingDuplicateNamedRoutes()
- {
- $this->expectException(\Cake\Routing\Exception\DuplicateNamedRouteException::class);
- $one = new Route('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
- $two = new Route('/', ['controller' => 'Dashboards', 'action' => 'display']);
- $this->collection->add($one, ['_name' => 'test']);
- $this->collection->add($two, ['_name' => 'test']);
- }
- /**
- * Test combined get/set method.
- *
- * @group deprecated
- * @return void
- */
- public function testExtensions()
- {
- $this->deprecated(function () {
- $this->assertEquals([], $this->collection->extensions());
- $this->collection->extensions('json');
- $this->assertEquals(['json'], $this->collection->extensions());
- $this->collection->extensions(['rss', 'xml']);
- $this->assertEquals(['json', 'rss', 'xml'], $this->collection->extensions());
- $this->collection->extensions(['csv'], false);
- $this->assertEquals(['csv'], $this->collection->extensions());
- });
- }
- /**
- * Test basic setExtension and its getter.
- *
- * @return void
- */
- public function testSetExtensions()
- {
- $this->assertEquals([], $this->collection->getExtensions());
- $this->collection->setExtensions(['json']);
- $this->assertEquals(['json'], $this->collection->getExtensions());
- $this->collection->setExtensions(['rss', 'xml']);
- $this->assertEquals(['json', 'rss', 'xml'], $this->collection->getExtensions());
- $this->collection->setExtensions(['csv'], false);
- $this->assertEquals(['csv'], $this->collection->getExtensions());
- }
- /**
- * Test adding middleware to the collection.
- *
- * @return void
- */
- public function testRegisterMiddleware()
- {
- $result = $this->collection->registerMiddleware('closure', function () {
- });
- $this->assertSame($result, $this->collection);
- $mock = $this->getMockBuilder('\stdClass')
- ->setMethods(['__invoke'])
- ->getMock();
- $result = $this->collection->registerMiddleware('callable', $mock);
- $this->assertSame($result, $this->collection);
- $this->assertTrue($this->collection->hasMiddleware('closure'));
- $this->assertTrue($this->collection->hasMiddleware('callable'));
- $this->collection->registerMiddleware('class', 'Dumb');
- }
- /**
- * Test adding a middleware group to the collection.
- *
- * @return void
- */
- public function testMiddlewareGroup()
- {
- $this->collection->registerMiddleware('closure', function () {
- });
- $mock = $this->getMockBuilder('\stdClass')
- ->setMethods(['__invoke'])
- ->getMock();
- $result = $this->collection->registerMiddleware('callable', $mock);
- $this->collection->registerMiddleware('callable', $mock);
- $this->collection->middlewareGroup('group', ['closure', 'callable']);
- $this->assertTrue($this->collection->hasMiddlewareGroup('group'));
- }
- /**
- * Test adding a middleware group with the same name overwrites the original list
- *
- * @return void
- */
- public function testMiddlewareGroupOverwrite()
- {
- $stub = function () {
- };
- $this->collection->registerMiddleware('closure', $stub);
- $result = $this->collection->registerMiddleware('callable', $stub);
- $this->collection->registerMiddleware('callable', $stub);
- $this->collection->middlewareGroup('group', ['callable']);
- $this->collection->middlewareGroup('group', ['closure', 'callable']);
- $this->assertSame([$stub, $stub], $this->collection->getMiddleware(['group']));
- }
- /**
- * Test adding ab unregistered middleware to a middleware group fails.
- *
- * @return void
- */
- public function testMiddlewareGroupUnregisteredMiddleware()
- {
- $this->expectException(\RuntimeException::class);
- $this->expectExceptionMessage('Cannot add \'bad\' middleware to group \'group\'. It has not been registered.');
- $this->collection->middlewareGroup('group', ['bad']);
- }
- }
|