CleanupGeneratedPdfDailyTaskTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 9 2
A testCronScheduleIsConfigurable() 0 5 1
1
<?php
2
3
namespace CWP\PDFExport\Tests\Tasks;
4
5
use CWP\PDFExport\Tasks\CleanupGeneratedPdfDailyTask;
6
use SilverStripe\Core\Config\Config;
7
use SilverStripe\CronTask\Interfaces\CronTask;
0 ignored issues
show
Bug introduced by
The type SilverStripe\CronTask\Interfaces\CronTask 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...
8
use SilverStripe\Dev\SapphireTest;
9
10
class CleanupGeneratedPdfDailyTaskTest extends SapphireTest
11
{
12
    /**
13
     * @var CleanupGeneratedPdfDailyTask
14
     */
15
    protected $task;
16
17
    protected function setUp()
18
    {
19
        parent::setUp();
20
21
        if (!interface_exists(CronTask::class)) {
22
            $this->markTestSkipped('Test class requires the silverstripe/crontask module to be installed');
23
        }
24
25
        $this->task = new CleanupGeneratedPdfDailyTask();
26
    }
27
28
    public function testCronScheduleIsConfigurable()
29
    {
30
        Config::modify()->set(CleanupGeneratedPdfDailyTask::class, 'schedule', '* 1 2 3 *');
31
32
        $this->assertSame('* 1 2 3 *', $this->task->getSchedule());
33
    }
34
}
35