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