Add a test for registering a user.

This commit is contained in:
Dave Smith-Hayes 2024-05-25 22:47:52 -04:00
parent d1ffe814cc
commit 4548d67eac
2 changed files with 35 additions and 0 deletions

View File

@ -4,15 +4,24 @@ namespace Slovocast;
use Slim\App; use Slim\App;
use Slim\Factory\AppFactory; use Slim\Factory\AppFactory;
use League\Config\Configuration; use League\Config\Configuration;
use DI\Container; use DI\Container;
use DI\ContainerBuilder; use DI\ContainerBuilder;
use Slim\Views\Twig; use Slim\Views\Twig;
use Slim\Views\TwigMiddleware; use Slim\Views\TwigMiddleware;
use Slovocast\Routes; use Slovocast\Routes;
use Slovocast\Configuration\SiteInformationSchema; use Slovocast\Configuration\SiteInformationSchema;
use Slovocast\Configuration\DatabaseConnectionSchema; use Slovocast\Configuration\DatabaseConnectionSchema;
use Psr\Log\LoggerInterface;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Level;
class Bootstrap class Bootstrap
{ {
/** /**
@ -58,6 +67,13 @@ class Bootstrap
'flash' => function () { 'flash' => function () {
$messages = []; $messages = [];
return new \Slim\Flash\Messages($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(); session_start();
} }
/** @var $this ContainerInterface */
$this->get('flash')->__construct($_SESSION); $this->get('flash')->__construct($_SESSION);
return $next->handle($req); return $next->handle($req);

View File

@ -0,0 +1,18 @@
<?php
namespace Slovocast\Tests\Controller\User;
use Slovocast\Tests\TestCase;
class RegisterUserActionTest extends TestCase
{
public function testSuccessfulRegistration(): void
{
}
public function testFailingRegistration(): void
{
}
}