IndexControllerTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 40
ccs 22
cts 22
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 15 1
A testIndexActionCanBeAccessed() 0 9 1
1
<?php
2
/**
3
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
4
 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
5
 * @license   http://framework.zend.com/license/new-bsd New BSD License
6
 */
7
8
namespace ApplicationTest\Controller;
9
10
use Application\Controller\IndexController;
11
use Zend\Stdlib\ArrayUtils;
12
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
13
14
class IndexControllerTest extends AbstractHttpControllerTestCase
15
{
16 3
    public function setUp()
17
    {
18
        // The module configuration should still be applicable for tests.
19
        // You can override configuration here with test case specific values,
20
        // such as sample view templates, path stacks, module_listener_options,
21
        // etc.
22 3
        $configOverrides = [];
23
24 3
        $this->setApplicationConfig(ArrayUtils::merge(
25 3
            include __DIR__.'/../../../../config/application.config.php',
26
            $configOverrides
27
        ));
28
29 3
        parent::setUp();
30 3
    }
31
32 1
    public function testIndexActionCanBeAccessed()
33
    {
34 1
        $this->dispatch('/', 'GET');
35 1
        $this->assertResponseStatusCode(200);
36 1
        $this->assertModuleName('application');
37 1
        $this->assertControllerName(IndexController::class); // as specified in router's controller name alias
38 1
        $this->assertControllerClass('IndexController');
39 1
        $this->assertMatchedRouteName('home');
40 1
    }
41
42 1
    public function testIndexActionViewModelTemplateRenderedWithinLayout()
43
    {
44 1
        $this->dispatch('/', 'GET');
45 1
        $this->assertQuery('#home-content-wrapper');
46 1
    }
47
48 1
    public function testInvalidRouteDoesNotCrash()
49
    {
50 1
        $this->dispatch('/invalid/route', 'GET');
51 1
        $this->assertResponseStatusCode(404);
52 1
    }
53
}
54