1 | <?php |
||
16 | class TestMethod extends ExecutableTest |
||
17 | { |
||
18 | /** |
||
19 | * The path to the test case file. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $path; |
||
24 | |||
25 | /** |
||
26 | * A set of filters for test, they are merged into phpunit's --filter option. |
||
27 | * |
||
28 | * @var string[] |
||
29 | */ |
||
30 | protected $filters; |
||
31 | |||
32 | /** |
||
33 | * Constructor. |
||
34 | * |
||
35 | * Passed filters must be unescaped and must represent test name, optionally including |
||
36 | * dataset name (numeric or named). |
||
37 | * |
||
38 | * @param string $testPath path to phpunit test case file |
||
39 | * @param string[] $filters array of filters or single filter |
||
40 | */ |
||
41 | 21 | public function __construct(string $testPath, array $filters) |
|
48 | |||
49 | /** |
||
50 | * Returns the test method's filters. |
||
51 | * |
||
52 | * @return string[] |
||
53 | */ |
||
54 | public function getFilters(): array |
||
58 | |||
59 | /** |
||
60 | * Returns the test method's name. |
||
61 | * |
||
62 | * This method will join all filters via pipe character and return as string. |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | 3 | public function getName(): string |
|
70 | |||
71 | /** |
||
72 | * Additional processing for options being passed to PHPUnit. |
||
73 | * |
||
74 | * This sets up the --filter switch used to run a single PHPUnit test method. |
||
75 | * This method also provide escaping for method name to be used as filter regexp. |
||
76 | * |
||
77 | * @param array $options |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | protected function prepareOptions(array $options): array |
||
92 | |||
93 | /** |
||
94 | * Get the expected count of tests to be executed. |
||
95 | * |
||
96 | * @return int |
||
97 | */ |
||
98 | 1 | public function getTestCount(): int |
|
102 | } |
||
103 |