ExceptionControllerTest::tearDown()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * (c) webfactory GmbH <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Webfactory\Bundle\ExceptionsBundle\Tests\Controller;
11
12
use Webfactory\Bundle\ExceptionsBundle\Controller\ExceptionController;
13
14
/**
15
 * Tests for the ExceptionController.
16
 */
17
class ExceptionControllerTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * System under test.
21
     *
22
     * @var ExceptionController
23
     */
24
    private $controller;
25
26
    /**
27
     * @see PHPUnit_Framework_TestCase::setUp()
28
     */
29
    protected function setUp()
30
    {
31
        $this->controller = new ExceptionController(new \Twig_Environment(), true);
32
        parent::setUp();
33
    }
34
35
    /**
36
     * @see PHPUnit_Framework_TestCase::tearDown()
37
     */
38
    protected function tearDown()
39
    {
40
        $this->controller = null;
41
        parent::tearDown();
42
    }
43
44
    /**
45
     * Ensures that the ExceptionBundle's ExceptionController is a TwigBundle's ExceptionController.
46
     */
47
    public function testSutIsATwigExceptionController()
48
    {
49
        $this->assertInstanceOf('Symfony\Bundle\TwigBundle\Controller\ExceptionController', $this->controller);
50
    }
51
52
    /**
53
     * Ensures that setDebug sets the otherwise immutable value of 'debug'. There is no getter to test a round trip.
54
     */
55
    public function testSetDebugSetsValue()
56
    {
57
        $expectedValue = false;
58
        $this->assertAttributeNotEquals($expectedValue, 'debug', $this->controller, 'Test prerequisite not met.');
59
60
        $this->controller->setDebug($expectedValue);
61
        $this->assertAttributeEquals($expectedValue, 'debug', $this->controller);
62
    }
63
}
64