Test Failed
Pull Request — master (#132)
by Alessandro
03:15
created

StubbedParaunitProcess::getExitCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\Stub;
6
7
use Paraunit\Process\AbstractParaunitProcess;
8
9
/**
10
 * Class StubbedParaunitProcess
11
 * @package Tests\Stub
12
 */
13
class StubbedParaunitProcess extends AbstractParaunitProcess
14
{
15
    /** @var string */
16
    private $output;
17
18
    /** @var string */
19
    private $commandLine;
20
21
    /** @var int */
22
    private $exitCode;
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function __construct(
28
        string $filename = 'testFilename',
29
        string $uniqueId = null
30
    ) {
31
        parent::__construct($filename);
32
33
        if (null !== $uniqueId) {
34
            $this->uniqueId = $uniqueId;
35
        }
36
37
        $this->commandLine = 'phpunit /stub/test';
38
        $this->exitCode = 0;
39
    }
40
41
    public function setFilename(string $filename)
42
    {
43
        $this->filename = $filename;
44
    }
45
46
    public function setIsToBeRetried(bool $isToBeRetried)
47
    {
48
        $this->shouldBeRetried = $isToBeRetried;
49
    }
50
51
    public function getCommandLine(): string
52
    {
53
        return $this->commandLine;
54
    }
55
56
    public function setOutput(string $output)
57
    {
58
        $this->output = $output;
59
    }
60
61
    public function setExitCode(int $exitCode)
62
    {
63
        $this->exitCode = $exitCode;
64
    }
65
66
    public function getOutput(): string
67
    {
68
        return $this->output ?? '';
69
    }
70
71
    public function isTerminated(): bool
72
    {
73
        return true;
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79
    public function start(int $pipeline)
80
    {
81
        $this->reset();
82
    }
83
84
    public function getExitCode(): int
85
    {
86
        return $this->exitCode;
87
    }
88
}
89