Passed
Push — master ( b0febc...99b0a5 )
by Jakub
01:55
created

JobResultTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFromJob() 0 18 1
1
<?php
2
declare(strict_types=1);
3
4
namespace MyTester;
5
6
use MyTester\Attributes\TestSuite;
7
8
/**
9
 * Test suite for class JobResult
10
 *
11
 * @author Jakub Konečný
12
 */
13
#[TestSuite("JobResultTest")]
14
final class JobResultTest extends TestCase
15
{
16
    public function testFromJob(): void
17
    {
18
        $job = new Job("Test Job", function () {
19
        });
20
        $job->execute();
21
        $this->assertSame(JobResult::PASSED, JobResult::fromJob($job));
22
23
        $job = new Job("Test Job", function () {
24
            echo "Test failed. Reason";
25
        });
26
        $job->execute();
27
        $this->assertSame(JobResult::FAILED, JobResult::fromJob($job));
28
29
        $job = new Job("Test Job", function () {
30
            echo "Warning: Text";
31
        });
32
        $job->execute();
33
        $this->assertSame(JobResult::WARNING, JobResult::fromJob($job));
34
    }
35
}
36