CakeProducts/tests/test_app/src/Application.php

40 lines
913 B
PHP

<?php
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 {
/**
* @inheritDoc
*/
public function bootstrap(): void {
$this->addPlugin('CakeProducts');
}
/**
* @inheritDoc
*/
public function middleware(MiddlewareQueue $middleware): MiddlewareQueue {
$middleware->add(new RoutingMiddleware($this));
return $middleware;
}
public function routes(RouteBuilder $routes): void
{
parent::routes($routes); // TODO: Change the autogenerated stub
$routes->setRouteClass(DashedRoute::class);
$routes->plugin('CakeProducts', ['path' => '/cake-products'], function (RouteBuilder $pluginRoutes):void {
$pluginRoutes->fallbacks();
});
}
}