Passed
Push — master ( b6f9c0...18138a )
by Robbie
02:20
created

SecurityAlertExtensionTest::setUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 0
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
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
            $this->markTestSkipped(
19
                'Module bringyourownideas/silverstripe-maintenance is required for this test, but is not present.'
20
            );
21
        }
22
23
        QueuedJobService::config()->set('use_shutdown_function', false);
24
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