protected function assertControllerWorks($controller) { $uris = EasyRouting::getUris($controller); $this->assertPagesWorks($uris); }
public function test() { $this->assertControllerWorks(WebServerTestController::class); $this->assertPageContains(EasyRouting::getUri(WebServerTestController::class, 'index'), WebServerTestController::TEXT); }
public function testAllPages() { $this->assertPagesWorks(EasyRouting::getUris(Controller::class)); }
protected function initializeLayout() { $this->layoutInstance = new Layout('layout'); $actions = EasyRouting::getUris(static::class); $this->layoutInstance->section('menu')->addChild(new TemplateView('menu/menu', compact('actions'))); }
public function test() { $uri = EasyRouting::getUri(WebServerTestController::class, 'layoutDemo'); $this->assertPageContains($uri, 'Layout is ok'); $this->assertPageContains($uri, 'Layout test'); }
use ViewComponents\TestingHelpers\Application\Http\WebServerTestController; use ViewComponents\ViewComponents\Rendering\RendererInterface; use ViewComponents\ViewComponents\Service\Bootstrap; use ViewComponents\ViewComponents\Service\ServiceContainer; use ViewComponents\ViewComponents\Service\ServiceId; use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\ExceptionHandler; require __DIR__ . '/bootstrap.php'; // create app $app = new Application(); $app['debug'] = true; // error handling ErrorHandler::register(); ExceptionHandler::register(); // register basic controller $routeGenerator = EasyRouting::instance($app); $routeGenerator->make(WebServerTestController::class); // register additional controllers $controllers = getenv('WEBAPP_CONTROLLERS'); $hasAdditionalControllers = false; if ($controllers !== false) { $controllers = explode(',', $controllers); foreach ($controllers as $controller) { $routeGenerator->make($controller); } } $routeGenerator->make(WebServerTestController::class); if (!$hasAdditionalControllers) { $app->get('/', WebServerTestController::class . '::' . 'index'); } Bootstrap::registerServiceProvider(function (ServiceContainer $container) {