CheeseCake/tests/test_app/src/Application.php

35 lines
833 B
PHP
Raw Normal View History

<?php declare(strict_types=1);
namespace TestApp;
use Cake\Http\BaseApplication;
use Cake\Http\MiddlewareQueue;
use Cake\Routing\Middleware\RoutingMiddleware;
use Cake\Routing\Route\DashedRoute;
use Cake\Routing\RouteBuilder;
class Application extends BaseApplication {
/**
* @param \Cake\Routing\RouteBuilder $routes
*
* @return void
*/
public function routes(RouteBuilder $routes): void {
$routes->scope('/', function(RouteBuilder $routes) {
$routes->fallbacks(DashedRoute::class);
});
}
/**
* @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to set in your App Class
* @return \Cake\Http\MiddlewareQueue
*/
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue {
$middlewareQueue->add(new RoutingMiddleware($this));
return $middlewareQueue;
}
}