39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace AppTest\Handler;
|
||
|
|
||
|
use App\Handler\HomePageHandler;
|
||
|
use App\Handler\HomePageHandlerFactory;
|
||
|
use AppTest\InMemoryContainer;
|
||
|
use Mezzio\Router\RouterInterface;
|
||
|
use Mezzio\Template\TemplateRendererInterface;
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
|
||
|
class HomePageHandlerFactoryTest extends TestCase
|
||
|
{
|
||
|
public function testFactoryWithoutTemplate(): void
|
||
|
{
|
||
|
$container = new InMemoryContainer();
|
||
|
$container->setService(RouterInterface::class, $this->createMock(RouterInterface::class));
|
||
|
|
||
|
$factory = new HomePageHandlerFactory();
|
||
|
$homePage = $factory($container);
|
||
|
|
||
|
self::assertInstanceOf(HomePageHandler::class, $homePage);
|
||
|
}
|
||
|
|
||
|
public function testFactoryWithTemplate(): void
|
||
|
{
|
||
|
$container = new InMemoryContainer();
|
||
|
$container->setService(RouterInterface::class, $this->createMock(RouterInterface::class));
|
||
|
$container->setService(TemplateRendererInterface::class, $this->createMock(TemplateRendererInterface::class));
|
||
|
|
||
|
$factory = new HomePageHandlerFactory();
|
||
|
$homePage = $factory($container);
|
||
|
|
||
|
self::assertInstanceOf(HomePageHandler::class, $homePage);
|
||
|
}
|
||
|
}
|