Total Complexity | 6 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
11 | final class MockTask extends Task |
||
12 | { |
||
13 | private $result; |
||
14 | |||
15 | public function __construct(string $description = 'my task') |
||
18 | } |
||
19 | |||
20 | public function getResult(): Result |
||
21 | { |
||
22 | return $this->result; |
||
23 | } |
||
24 | |||
25 | public static function success(string $name = 'my task', ?string $output = null): self |
||
26 | { |
||
27 | $task = new self($name); |
||
28 | $task->result = Result::successful($task, $output); |
||
29 | |||
30 | return $task; |
||
31 | } |
||
32 | |||
33 | public static function failure(string $description = 'failure description', string $name = 'my task', ?string $output = null): self |
||
34 | { |
||
35 | $task = new self($name); |
||
36 | $task->result = Result::failure($task, $description, $output); |
||
37 | |||
38 | return $task; |
||
39 | } |
||
40 | |||
41 | public static function skipped(string $description = 'skip reason', string $name = 'my task') |
||
42 | { |
||
43 | $task = new self($name); |
||
44 | $task->result = Result::skipped($task, $description); |
||
45 | |||
46 | return $task; |
||
47 | } |
||
48 | |||
49 | public static function exception(\Throwable $e, string $name = 'my task', ?string $output = null): self |
||
55 | } |
||
56 | } |
||
57 |