diff --git a/app/src/Bootstrap.php b/app/src/Bootstrap.php index 7d49681..81e49d7 100644 --- a/app/src/Bootstrap.php +++ b/app/src/Bootstrap.php @@ -72,6 +72,9 @@ class Bootstrap $templatePath = __DIR__ . "/../templates"; $templateCache = false; $twig = Twig::create($templatePath, [ 'cache' => $templateCache ]); + // Add the global variables + $twig->getEnvironment()->addGlobal('site_name', "Slovocast"); + $twig->getEnvironment()->addGlobal('site_description', "A no-bullshit podcast hosting service"); $app->add(TwigMiddleware::create($app, $twig)); } diff --git a/app/tests/Controller/ControllerTest.php b/app/tests/Controller/ControllerTest.php index 349b887..55f936c 100644 --- a/app/tests/Controller/ControllerTest.php +++ b/app/tests/Controller/ControllerTest.php @@ -75,4 +75,26 @@ class ControllerTest extends TestCase $response->getHeaderLine('Content-Type') ); } + + /** + * We have some Global variables set in the Configuration, for now its + * hardcoded in the Bootstrap class. + */ + public function testRenderSiteName(): void + { + $testController = new class extends Controller { + public function respond(): Response + { + return $this->renderInline("