Completed
Pull Request — dev (#11)
by
unknown
05:12 queued 01:17
created

TestDummyController   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 6
Bugs 1 Features 0
Metric Value
wmc 6
c 6
b 1
f 0
lcom 2
cbo 2
dl 0
loc 39
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 4 1
A testAction() 0 4 1
A genericExceptionAction() 0 4 1
A defaultAction() 0 6 1
A arrayAction() 0 5 1
A otherViewAction() 0 7 1
1
<?php
2
3
namespace Vectorface\SnappyRouterTests\Controller;
4
5
use \Exception;
6
use Vectorface\SnappyRouter\Controller\AbstractController;
7
use Vectorface\SnappyRouter\Exception\InternalErrorException;
8
9
/**
10
 * A test controller for testing the router.
11
 * @copyright Copyright (c) 2014, VectorFace, Inc.
12
 * @author Dan Bruce <[email protected]>
13
 */
14
class TestDummyController extends AbstractController
15
{
16
17
    public function indexAction()
18
    {
19
20
    }
21
22
    public function testAction()
23
    {
24
        return 'This is a test service.';
25
    }
26
27
    public function genericExceptionAction()
28
    {
29
        throw new InternalErrorException('A generic exception.');
30
    }
31
32
    public function defaultAction()
33
    {
34
        // ensure some abstract methods work
35
        $this->set('request', $this->getRequest());
36
        $this->get('request');
37
    }
38
39
    public function arrayAction()
40
    {
41
        $this->viewContext['variable'] = 'broken';
42
        return array('variable' => 'test');
43
    }
44
45
    public function otherViewAction()
46
    {
47
        return $this->renderView(
48
            array('variable' => 'test'),
49
            'test/array.twig'
50
        );
51
    }
52
}
53