ProcessTaskTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 3
Metric Value
wmc 2
eloc 7
c 4
b 0
f 3
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A has_default_description() 0 4 1
A task_has_context() 0 7 1
1
<?php
2
3
namespace Zenstruck\ScheduleBundle\Tests\Schedule\Task;
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 Symfony\Component\Process\Process;
7
use Zenstruck\ScheduleBundle\Schedule\Task\ProcessTask;
8
9
/**
10
 * @author Kevin Bond <[email protected]>
11
 */
12
final class ProcessTaskTest extends TestCase
13
{
14
    /**
15
     * @test
16
     */
17
    public function has_default_description()
18
    {
19
        $this->assertSame('$(which php) -v', (new ProcessTask('$(which php) -v'))->getDescription());
20
        $this->assertSame('$(which php) -v', (new ProcessTask(Process::fromShellCommandline('$(which php) -v')))->getDescription());
21
    }
22
23
    /**
24
     * @test
25
     */
26
    public function task_has_context()
27
    {
28
        $task = new ProcessTask('/foo/bar');
29
        $this->assertSame(['Command Line' => '/foo/bar', 'Command Timeout' => '60'], $task->getContext());
30
31
        $task = new ProcessTask(Process::fromShellCommandline('/foo/bar')->setTimeout(30));
32
        $this->assertSame(['Command Line' => '/foo/bar', 'Command Timeout' => '30'], $task->getContext());
33
    }
34
}
35