}, ["admin", "middleware"]); $app->any('/abc/def', ["admin", "middleware"], ['admin', 'action']); $app->any('/abc/ghi', ["admin", "middleware"], ['admin', 'action'], function () { }); $app->any('/def/{id}/2', function () { }, function () { }); $app->any('/def/{id}/{name}', ["admin", "middleware"], function () { }); $app->any('/defg/{id}/{what}', function () { }, ["admin", "middleware"]); $app->any('/def/def/{shit}', ["admin", "action"], ['admin', 'middleware']); $app->any('/def/3/{zzz}', ["admin", "middleware"], ['admin', 'action'], function () { }); try { $app->dispatch($getMock); } catch (RuntimeException $e) { } } /****************************************************************/ $bench->end(); // Get elapsed time and memory echo $bench->getTime() . "\n"; // 156ms or 1.123s echo $bench->getTime(true) . "\n"; // elapsed microtime in float echo $bench->getTime(false, '%d%s') . "\n"; // 156ms or 1s echo $bench->getMemoryPeak() . "\n"; // 152B or 90.00Kb or 15.23Mb echo $bench->getMemoryPeak(true) . "\n";
public function testExecuteWithController() { $app = new Router(); $app->setController('admin', new AdminController()); $getMock = Mockery::mock(ServerRequestInterface::class); $getMock->shouldReceive('getMethod')->andReturn('GET'); $getMock->shouldReceive('getUri->getPath')->andReturn('/'); $getMock->shouldReceive('setArguments')->with([]); // $app->get('/', "middleware@admin", ['admin', 'action']); $app->get('/', ["admin", "middleware"], ['admin', 'action']); // $this->assertEquals('Hello World!!!', $app->dispatch($getMock)); $this->assertEquals('Hello World!!!', $app->dispatch($getMock)); }