ApplicationWithDefaultRoutes.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  6. *
  7. * Licensed under The MIT License
  8. * For full copyright and license information, please see the LICENSE.txt
  9. * Redistributions of files must retain the above copyright notice
  10. *
  11. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  12. * @link https://cakephp.org CakePHP(tm) Project
  13. * @since 3.5.2
  14. * @license https://opensource.org/licenses/mit-license.php MIT License
  15. */
  16. namespace TestApp;
  17. use Cake\Http\BaseApplication;
  18. use Cake\Http\MiddlewareQueue;
  19. use Cake\Routing\Middleware\RoutingMiddleware;
  20. /**
  21. * Simple Application class doing nothing that:
  22. *
  23. * - do nothing in bootstrap
  24. * - add just `RoutingMiddleware` to middleware queue
  25. *
  26. * Useful to test app using the default `BaseApplication::routes()` method
  27. */
  28. class ApplicationWithDefaultRoutes extends BaseApplication
  29. {
  30. /**
  31. * Bootstrap hook.
  32. *
  33. * Nerfed as this is for IntegrationTestCase testing.
  34. */
  35. public function bootstrap(): void
  36. {
  37. // Do nothing.
  38. }
  39. public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
  40. {
  41. $middlewareQueue->add(new RoutingMiddleware($this));
  42. return $middlewareQueue;
  43. }
  44. }