Passed
Push — master ( 18c542...46352d )
by Kevin
02:34
created

SelfRunningTaskRunnerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
c 0
b 0
f 0
dl 0
loc 18
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ __invoke() 0 3 1
A hp$0 ➔ supports_and_invokes_class() 0 13 1
supports_and_invokes_class() 0 13 ?
1
<?php
2
3
namespace Zenstruck\ScheduleBundle\Tests\Schedule\Task\Runner;
4
5
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase 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 Zenstruck\ScheduleBundle\Schedule\Task;
7
use Zenstruck\ScheduleBundle\Schedule\Task\Result;
8
use Zenstruck\ScheduleBundle\Schedule\Task\Runner\SelfRunningTaskRunner;
9
use Zenstruck\ScheduleBundle\Schedule\Task\SelfRunningTask;
10
11
/**
12
 * @author Kevin Bond <[email protected]>
13
 */
14
final class SelfRunningTaskRunnerTest extends TestCase
15
{
16
    /**
17
     * @test
18
     */
19
    public function supports_and_invokes_class()
20
    {
21
        $task = new class('my task') extends Task implements SelfRunningTask {
22
            public function __invoke(): Result
23
            {
24
                return Result::successful($this);
25
            }
26
        };
27
28
        $runner = new SelfRunningTaskRunner();
29
30
        $this->assertTrue($runner->supports($task));
31
        $this->assertTrue($runner($task)->isSuccessful());
32
    }
33
}
34