* initial commit
This commit is contained in:
45
test/AppTest/Action/HomePageFactoryTest.php
Normal file
45
test/AppTest/Action/HomePageFactoryTest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace AppTest\Action;
|
||||
|
||||
use App\Action\HomePageAction;
|
||||
use App\Action\HomePageFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Zend\Expressive\Router\RouterInterface;
|
||||
use Zend\Expressive\Template\TemplateRendererInterface;
|
||||
|
||||
class HomePageFactoryTest extends TestCase
|
||||
{
|
||||
/** @var ContainerInterface */
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->container = $this->prophesize(ContainerInterface::class);
|
||||
|
||||
$router = $this->prophesize(RouterInterface::class);
|
||||
$templateRenderer = $this->prophesize(TemplateRendererInterface::class);
|
||||
|
||||
$this->container->get(TemplateRendererInterface::class)->willReturn($templateRenderer);
|
||||
$this->container->get(RouterInterface::class)->willReturn($router);
|
||||
$this->container->get("config")->willReturn(['application'=>[]]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
public function testFactory()
|
||||
{
|
||||
$factory = new HomePageFactory();
|
||||
$this->assertInstanceOf(HomePageFactory::class, $factory);
|
||||
|
||||
$homePage = $factory($this->container->reveal());
|
||||
$this->assertInstanceOf(HomePageAction::class, $homePage);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user