1 | <?php |
||
13 | abstract class AbstractParaunitProcess |
||
14 | { |
||
15 | /** @var int */ |
||
16 | protected $retryCount = 0; |
||
17 | |||
18 | /** @var bool */ |
||
19 | protected $shouldBeRetried; |
||
20 | |||
21 | /** @var string */ |
||
22 | protected $uniqueId; |
||
23 | |||
24 | /** @var string */ |
||
25 | protected $filename; |
||
26 | |||
27 | /** @var string */ |
||
28 | protected $testClassName; |
||
29 | |||
30 | /** @var PrintableTestResultInterface[] */ |
||
31 | protected $testResults; |
||
32 | |||
33 | /** @var bool */ |
||
34 | private $waitingForTestResult; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | * @throws \InvalidArgumentException |
||
39 | */ |
||
40 | public function __construct(string $filename) |
||
41 | { |
||
42 | $this->filename = $filename; |
||
43 | $this->uniqueId = md5($this->filename); |
||
44 | $this->testResults = []; |
||
45 | $this->waitingForTestResult = true; |
||
46 | $this->shouldBeRetried = false; |
||
47 | } |
||
48 | |||
49 | abstract public function getOutput(): string; |
||
50 | |||
51 | abstract public function isTerminated(): bool; |
||
52 | |||
53 | abstract public function getCommandLine(): string; |
||
54 | |||
55 | /** |
||
56 | * @return int|null |
||
57 | */ |
||
58 | abstract public function getExitCode(); |
||
59 | |||
60 | /** |
||
61 | * @param array $env An array of environment variables to be injected |
||
62 | * @return void |
||
63 | */ |
||
64 | abstract public function start(array $env = []); |
||
65 | |||
66 | public function getUniqueId(): string |
||
70 | |||
71 | public function getRetryCount(): int |
||
75 | |||
76 | public function increaseRetryCount() |
||
80 | |||
81 | public function markAsToBeRetried() |
||
86 | |||
87 | public function isToBeRetried(): bool |
||
91 | |||
92 | public function reset() |
||
96 | |||
97 | public function getFilename(): string |
||
101 | |||
102 | /** |
||
103 | * @return string|null |
||
104 | */ |
||
105 | public function getTestClassName() |
||
109 | |||
110 | public function setTestClassName(string $testClassName) |
||
114 | |||
115 | /** |
||
116 | * @return PrintableTestResultInterface[] |
||
117 | */ |
||
118 | public function getTestResults(): array |
||
122 | |||
123 | public function addTestResult(PrintableTestResultInterface $testResult) |
||
128 | |||
129 | public function hasAbnormalTermination(): bool |
||
133 | |||
134 | public function isWaitingForTestResult(): bool |
||
138 | |||
139 | public function setWaitingForTestResult(bool $waitingForTestResult) |
||
143 | } |
||
144 |