protected function setUp() { $this->app->backup(); $application = new \Nano\Application(); $application->withConfigurationFormat('php')->withRootDir(dirName(dirName(dirName(__DIR__))) . DS . 'application-example')->configure(); $this->redirect = new \Nano\Controller\Redirect(new \Nano\Controller\Response($application)); }
protected function setUp() { $this->app->backup(); require_once $this->files->get($this, '/Test_Dispatcher.php'); $application = new \Nano\Application(); $application->withConfigurationFormat('php')->withRootDir(__DIR__)->configure(); $this->dispatcher = $application->dispatcher; $this->dispatcher->setCustom(new Test_Dispatcher()); $this->dispatcher->throwExceptions(true); }
public function testDetectingContextBySuffix() { Nano::setApplication(null); $application = new \Nano\Application(); $application->withConfigurationFormat('php')->withRootDir($this->files->get($this, ''))->configure(); $application->dispatcher->setResponse(new \Nano\Controller\Response\Test($application)); $_SERVER['REQUEST_METHOD'] = 'GET'; $routes = new \Nano\Routes(); $routes->suffix('~(\\.(?P<context>xml|rss))?')->get('index', 'test', 'index'); self::assertInstanceOf('Nano\\Route\\RegExp', $application->dispatcher->getRoute($routes, 'index.xml')); $application->dispatcher->run($application->dispatcher->getRoute($routes, 'index.xml')); self::assertEquals('xml', $application->dispatcher->controllerInstance()->context); }
<?php $application = new \Nano\Application(); $application->withConfigurationFormat('php')->withRootDir(__DIR__)->withModulesDir(__DIR__ . DIRECTORY_SEPARATOR . 'application-modules')->withSharedModulesDir(__DIR__ . DIRECTORY_SEPARATOR . 'shared-modules')->withModule('module1')->withModule('module2')->withModule('module3')->withModule('module4')->withModule('module5')->configure();
<?php require_once __DIR__ . '/../library/Application.php'; $application = new \Nano\Application(); $application->withConfigurationFormat('php')->withRootDir(__DIR__)->withPlugin(new Nano\TestUtils\Coverage\Plugin(__DIR__))->configure();