ControllerTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testErrorWhenModuleIsDisabled() 0 5 1
A testErrorWhenStorageIsDisabled() 0 5 1
A tearDown() 0 4 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
12
    public function tearDown(): void
13
    {
14
        parent::tearDown();
15
        DebugBar::clearDebugBar();
16
    }
17
18
    public function testErrorWhenStorageIsDisabled()
19
    {
20
        Config::modify()->set(DebugBar::class, 'enable_storage', false);
21
        $result = $this->get('/__debugbar');
22
        $this->assertEquals(404, $result->getStatusCode());
23
    }
24
25
    public function testErrorWhenModuleIsDisabled()
26
    {
27
        Config::modify()->set(DebugBar::class, 'disabled', true);
28
        $result = $this->get('/__debugbar');
29
        $this->assertEquals(404, $result->getStatusCode());
30
    }
31
}
32