EnablerExtensionTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 17
c 1
b 0
f 0
dl 0
loc 32
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testThatSecurityActionsHaveUpdatedThemeListApplied() 0 4 1
A setUp() 0 15 1
A testThatExcludedActionsDoNotHaveTheUpdatedThemeListApplied() 0 4 1
1
<?php
2
3
namespace SilverStripe\LoginForms\Tests;
4
5
use SilverStripe\Core\Config\Config;
0 ignored issues
show
Bug introduced by
The type SilverStripe\Core\Config\Config was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use SilverStripe\Dev\FunctionalTest;
0 ignored issues
show
Bug introduced by
The type SilverStripe\Dev\FunctionalTest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use SilverStripe\LoginForms\EnablerExtension;
8
use SilverStripe\Security\Security;
0 ignored issues
show
Bug introduced by
The type SilverStripe\Security\Security was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use SilverStripe\View\SSViewer;
0 ignored issues
show
Bug introduced by
The type SilverStripe\View\SSViewer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
class EnablerExtensionTest extends FunctionalTest
12
{
13
    protected $usesDatabase = true;
14
15
    protected function setUp()
16
    {
17
        parent::setUp();
18
        $config = Config::modify();
19
        $config->set(SSViewer::class, 'themes', [
20
            '$public',
21
            '$default',
22
        ]);
23
        $config->set(EnablerExtension::class, 'login_themes', [
24
            'silverstripe/login-forms:login-forms',
25
            '$default',
26
        ]);
27
        $config->set(EnablerExtension::class, 'excluded_actions', [
28
            'index',
29
            'ping',
30
        ]);
31
    }
32
33
    public function testThatSecurityActionsHaveUpdatedThemeListApplied()
34
    {
35
        $this->get(Security::login_url());
36
        $this->assertContains('silverstripe/login-forms:login-forms', SSViewer::get_themes());
37
    }
38
39
    public function testThatExcludedActionsDoNotHaveTheUpdatedThemeListApplied()
40
    {
41
        $this->get('Security/index');
42
        $this->assertNotContains('silverstripe/login-forms:login-forms', SSViewer::get_themes());
43
    }
44
}
45