-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndexControllerTest.php
56 lines (46 loc) · 1.81 KB
/
IndexControllerTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @see https://github.com/laminas/laminas-mvc-skeleton for the canonical source repository
* @copyright https://github.com/laminas/laminas-mvc-skeleton/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-mvc-skeleton/blob/master/LICENSE.md New BSD License
*/
declare(strict_types=1);
namespace ApplicationTest\Controller;
use Application\Controller\IndexController;
use Laminas\Stdlib\ArrayUtils;
use Laminas\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class IndexControllerTest extends AbstractHttpControllerTestCase
{
public function setUp() : void
{
// The module configuration should still be applicable for tests.
// You can override configuration here with test case specific values,
// such as sample view templates, path stacks, module_listener_options,
// etc.
$configOverrides = [];
$this->setApplicationConfig(ArrayUtils::merge(
include __DIR__ . '/../../../../config/application.config.php',
$configOverrides
));
parent::setUp();
}
public function testIndexActionCanBeAccessed()
{
$this->dispatch('/', 'GET');
$this->assertResponseStatusCode(200);
$this->assertModuleName('application');
$this->assertControllerName(IndexController::class); // as specified in router's controller name alias
$this->assertControllerClass('IndexController');
$this->assertMatchedRouteName('home');
}
public function testIndexActionViewModelTemplateRenderedWithinLayout()
{
$this->dispatch('/', 'GET');
$this->assertQuery('.container .jumbotron');
}
public function testInvalidRouteDoesNotCrash()
{
$this->dispatch('/invalid/route', 'GET');
$this->assertResponseStatusCode(404);
}
}