Пример #1
0
    public function testDispatch()
    {
        $request = new RequestAggregate();
        $request->setRequest(new Param(''));
        Router::add('/', ['controller' => 'Pages', 'action' => 'index', 'arguments' => [1]]);
        $dispatcher = new Dispatcher($request);
        $expect = '<div><p>1</p>
</div>
';
        $this->expectOutputString($expect);
        $dispatcher->dispatch($request);
    }
Пример #2
0
<?php

require '../vendor/autoload.php';
require '../config/bootstrap.php';
use TRW\Router\Dispatcher;
use TRW\Request\RequestAggregate;
//$_SERVER['REQUEST_URI'] = '/Users/index/1';
$dispatcher = new Dispatcher();
$dispatcher->dispatch(RequestAggregate::createFromGlobals());