1 | <?php declare(strict_types=1); |
||
10 | abstract class TestCase extends PHPUnitTestCase |
||
11 | { |
||
12 | const DEFAULT_AWAIT_TIMEOUT = 60; |
||
13 | const WIN_START = 0; |
||
14 | const WIN_END = 3; |
||
15 | const USLEEP = 50; |
||
16 | const DEFAULT_MODE = 0777; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $baseTmpDir; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $tmpDir; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $tmpNamespace; |
||
32 | |||
33 | 73 | protected function setUp(): void |
|
34 | { |
||
35 | 73 | $this->baseTmpDir = $this->getSysTempDir() . |
|
36 | 73 | \DIRECTORY_SEPARATOR . |
|
37 | 73 | 'p-a-c-t-' . |
|
38 | 73 | \uniqid() . |
|
39 | 73 | \DIRECTORY_SEPARATOR; |
|
40 | 73 | $this->tmpDir = $this->baseTmpDir . |
|
41 | 73 | \uniqid() . |
|
42 | 73 | \DIRECTORY_SEPARATOR; |
|
43 | ; |
||
44 | |||
45 | 73 | $this->tmpNamespace = \uniqid('PACTN'); |
|
46 | 73 | } |
|
47 | |||
48 | 73 | protected function tearDown(): void |
|
49 | { |
||
50 | 73 | if (\file_exists($this->baseTmpDir)) { |
|
51 | 68 | $this->rmdir($this->baseTmpDir); |
|
52 | } |
||
53 | 73 | } |
|
54 | |||
55 | /** |
||
56 | * @return array |
||
57 | */ |
||
58 | public function provideTrueFalse(): array |
||
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | 73 | protected function getSysTempDir(): string |
|
81 | |||
82 | /** |
||
83 | * @param string $dir |
||
84 | */ |
||
85 | 69 | protected function rmdir(string $dir): void |
|
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | 68 | protected function getTmpDir(): string |
|
116 | |||
117 | /** |
||
118 | * @return string |
||
119 | */ |
||
120 | 67 | protected function getRandomNameSpace(): string |
|
124 | |||
125 | /** |
||
126 | * @param string $path |
||
127 | * @return array |
||
128 | */ |
||
129 | 67 | protected function getFilesInDirectory(string $path): array |
|
146 | |||
147 | 1 | protected static function waitUntilTheNextSecond(): void |
|
148 | { |
||
156 | } |
||
157 |