HelloJobTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 13
c 1
b 0
f 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRun() 0 13 1
A dataRun() 0 5 1
1
<?php
2
namespace App\Tests\Unit\Console\Job;
3
4
use App\Console\Job\HelloJob;
5
use Codeception\Test\Unit;
6
7
class HelloJobTest extends Unit
8
{
9
    /**
10
     * @dataProvider dataRun
11
     */
12
    public function testRun(string $name): void
13
    {
14
        $job = new HelloJob([
15
            'name' => $name,
16
        ]);
17
18
        $method = new \ReflectionMethod(HelloJob::class, 'run');
19
        $method->setAccessible(true);
20
        ob_start();
21
        $method->invoke($job);
22
        $output = ob_get_contents();
23
        ob_end_flush();
24
        $this->assertContains($name, $output);
25
    }
26
27
    public function dataRun(): array
28
    {
29
        return [
30
            ['foo'],
31
            ['bar'],
32
        ];
33
    }
34
}
35