From 4548d67eaca9d700cf8730375b19131005085c80 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Sat, 25 May 2024 22:47:52 -0400 Subject: [PATCH] Add a test for registering a user. --- app/src/Bootstrap.php | 17 +++++++++++++++++ .../Controller/User/RegisterUserActionTest.php | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 app/tests/Controller/User/RegisterUserActionTest.php diff --git a/app/src/Bootstrap.php b/app/src/Bootstrap.php index ee0442c..2de0523 100644 --- a/app/src/Bootstrap.php +++ b/app/src/Bootstrap.php @@ -4,15 +4,24 @@ namespace Slovocast; use Slim\App; use Slim\Factory\AppFactory; + use League\Config\Configuration; + use DI\Container; use DI\ContainerBuilder; + use Slim\Views\Twig; use Slim\Views\TwigMiddleware; + use Slovocast\Routes; use Slovocast\Configuration\SiteInformationSchema; use Slovocast\Configuration\DatabaseConnectionSchema; +use Psr\Log\LoggerInterface; +use Monolog\Logger; +use Monolog\Handler\StreamHandler; +use Monolog\Level; + class Bootstrap { /** @@ -58,6 +67,13 @@ class Bootstrap 'flash' => function () { $messages = []; return new \Slim\Flash\Messages($messages); + }, + LoggerInterface::class => function() { + $logger = new Logger(); + $logger->pushHandler( + new StreamHandler(__DIR__ . '/var/logs', Level::Warning) + ); + return $logger; } ]); @@ -108,6 +124,7 @@ class Bootstrap session_start(); } + /** @var $this ContainerInterface */ $this->get('flash')->__construct($_SESSION); return $next->handle($req); diff --git a/app/tests/Controller/User/RegisterUserActionTest.php b/app/tests/Controller/User/RegisterUserActionTest.php new file mode 100644 index 0000000..018b40b --- /dev/null +++ b/app/tests/Controller/User/RegisterUserActionTest.php @@ -0,0 +1,18 @@ +