GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( e58d6d...11aae6 )
by
unknown
18:36 queued 01:03
created

DoormanQueuedJobTaskTest::canRunTaskProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Symbiote\QueuedJobs\Tests\Jobs;
4
5
use SilverStripe\Dev\SapphireTest;
6
use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor;
7
use Symbiote\QueuedJobs\Jobs\DoormanQueuedJobTask;
8
use Symbiote\QueuedJobs\Services\QueuedJob;
9
10
class DoormanQueuedJobTaskTest extends SapphireTest
11
{
12
    protected static $fixture_file = 'DoormanQueuedJobTaskTest.yml';
13
14
    /**
15
     * @dataProvider canRunTaskProvider
16
     * @param string $status
17
     * @param bool $expected
18
     */
19 View Code Duplication
    public function testCanRunTask($status, $expected)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        /** @var QueuedJobDescriptor $descriptor */
22
        $descriptor = $this->objFromFixture(QueuedJobDescriptor::class, 'dummy_job');
23
        $descriptor->JobStatus = $status;
24
        $descriptor->write();
25
26
        $task = new DoormanQueuedJobTask($descriptor);
27
        $this->assertSame($expected, $task->canRunTask());
28
    }
29
30
    /**
31
     * @return array[]
32
     */
33
    public function canRunTaskProvider()
34
    {
35
        return [
36
            [QueuedJob::STATUS_NEW, true],
37
            [QueuedJob::STATUS_INIT, true],
38
            [QueuedJob::STATUS_WAIT, true],
39
            [QueuedJob::STATUS_RUN, false],
40
        ];
41
    }
42
43
    /**
44
     * @dataProvider isCancelledProvider
45
     * @param string $status
46
     * @param bool $expected
47
     */
48 View Code Duplication
    public function testIsCancelled($status, $expected)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
49
    {
50
        /** @var QueuedJobDescriptor $descriptor */
51
        $descriptor = $this->objFromFixture(QueuedJobDescriptor::class, 'dummy_job');
52
        $descriptor->JobStatus = $status;
53
        $descriptor->write();
54
55
        $task = new DoormanQueuedJobTask($descriptor);
56
        $this->assertSame($expected, $task->isCancelled());
57
    }
58
59
    /**
60
     * @return array[]
61
     */
62
    public function isCancelledProvider()
63
    {
64
        return [
65
            [QueuedJob::STATUS_CANCELLED, true],
66
            [QueuedJob::STATUS_COMPLETE, true],
67
            [QueuedJob::STATUS_INIT, false],
68
        ];
69
    }
70
}
71