Completed
Pull Request — master (#47)
by Robbie
09:57
created

ControllerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 22
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 5 1
A testErrorWhenStorageIsDisabled() 0 6 1
A testErrorWhenModuleIsDisabled() 0 6 1
1
<?php
2
3
namespace LeKoala\DebugBar\Test;
4
5
use LeKoala\DebugBar\DebugBar;
6
use SilverStripe\Core\Config\Config;
7
use SilverStripe\Dev\FunctionalTest;
8
9
class ControllerTest extends FunctionalTest
10
{
11
    public function tearDown()
12
    {
13
        parent::tearDown();
14
        DebugBar::clearDebugBar();
15
    }
16
17
    public function testErrorWhenStorageIsDisabled()
18
    {
19
        Config::modify()->set(DebugBar::class, 'enable_storage', false);
20
        $result = $this->get('/__debugbar');
21
        $this->assertEquals(404, $result->getStatusCode());
22
    }
23
24
    public function testErrorWhenModuleIsDisabled()
25
    {
26
        Config::modify()->set(DebugBar::class, 'disabled', true);
27
        $result = $this->get('/__debugbar');
28
        $this->assertEquals(404, $result->getStatusCode());
29
    }
30
}
31