SecurityAlertExtensionTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testExtensionAppliesWhenMaintenanceModuleIsPresent() 0 6 1
A setUp() 0 12 2
1
<?php
2
3
namespace BringYourOwnIdeas\SecurityChecker\Tests\Extensions;
4
5
use BringYourOwnIdeas\Maintenance\Model\Package;
0 ignored issues
show
Bug introduced by
The type BringYourOwnIdeas\Maintenance\Model\Package 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 BringYourOwnIdeas\SecurityChecker\Models\SecurityAlert;
7
use SilverStripe\Dev\SapphireTest;
8
use Symbiote\QueuedJobs\Services\QueuedJobService;
9
10
class SecurityAlertExtensionTest extends SapphireTest
11
{
12
    protected static $fixture_file = 'PackageSecurityExtensionTest.yml';
13
14
    protected function setUp()
15
    {
16
        if (!class_exists(Package::class)) {
17
            static::$fixture_file = null;
18
            parent::setUp();
19
            $this->markTestSkipped(
20
                'Module bringyourownideas/silverstripe-maintenance is required for this test, but is not present.'
21
            );
22
        }
23
24
        QueuedJobService::config()->set('use_shutdown_function', false);
25
        parent::setUp();
26
    }
27
28
    public function testExtensionAppliesWhenMaintenanceModuleIsPresent()
29
    {
30
        /** @var SecurityAlert $alert */
31
        $alert = $this->objFromFixture(SecurityAlert::class, 'two');
32
33
        $this->assertTrue($alert->PackageRecord()->exists());
0 ignored issues
show
Bug introduced by
The method PackageRecord() does not exist on BringYourOwnIdeas\Securi...er\Models\SecurityAlert. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        $this->assertTrue($alert->/** @scrutinizer ignore-call */ PackageRecord()->exists());
Loading history...
34
    }
35
}
36