mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 17:59:55 +02:00
init php-routing, unfinished
This commit is contained in:
parent
7df2011b73
commit
4b5e5cd4fe
102 changed files with 7428 additions and 370 deletions
34
objects/simple-php-router/test/MiddlewareTest.php
Normal file
34
objects/simple-php-router/test/MiddlewareTest.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
require_once 'Dummy/DummyMiddleware.php';
|
||||
require_once 'Dummy/DummyController.php';
|
||||
require_once 'Dummy/Handler/ExceptionHandler.php';
|
||||
require_once 'Helpers/TestRouter.php';
|
||||
|
||||
class MiddlewareTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testMiddlewareFound()
|
||||
{
|
||||
$this->setExpectedException(MiddlewareLoadedException::class);
|
||||
|
||||
TestRouter::group(['exceptionHandler' => 'ExceptionHandler'], function () {
|
||||
TestRouter::get('/my/test/url', 'DummyController@method1', ['middleware' => 'DummyMiddleware']);
|
||||
});
|
||||
|
||||
TestRouter::debug('/my/test/url', 'get');
|
||||
|
||||
}
|
||||
|
||||
public function testNestedMiddlewareDontLoad()
|
||||
{
|
||||
|
||||
TestRouter::group(['exceptionHandler' => 'ExceptionHandler', 'middleware' => 'DummyMiddleware'], function () {
|
||||
TestRouter::get('/middleware', 'DummyController@method1');
|
||||
});
|
||||
|
||||
TestRouter::get('/my/test/url', 'DummyController@method1');
|
||||
|
||||
TestRouter::debug('/my/test/url', 'get');
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue