|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Paraunit\Configuration; |
|
4
|
|
|
|
|
5
|
|
|
use Paraunit\File\TempDirectory; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class TempFilenameFactory |
|
9
|
|
|
* @package Tests\Unit\Parser |
|
10
|
|
|
*/ |
|
11
|
|
|
class TempFilenameFactory |
|
12
|
|
|
{ |
|
13
|
|
|
/** @var TempDirectory */ |
|
14
|
|
|
private $tempDirectory; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* TempFilenameFactory constructor. |
|
18
|
|
|
* @param TempDirectory $tempDirectory |
|
19
|
|
|
*/ |
|
20
|
38 |
|
public function __construct(TempDirectory $tempDirectory) |
|
21
|
|
|
{ |
|
22
|
38 |
|
$this->tempDirectory = $tempDirectory; |
|
23
|
38 |
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @return string |
|
27
|
|
|
*/ |
|
28
|
13 |
|
public function getPathForLog() |
|
29
|
|
|
{ |
|
30
|
13 |
|
return $this->getTempFilename('logs', '', ''); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param string $uniqueId |
|
35
|
|
|
* @return string |
|
36
|
|
|
*/ |
|
37
|
27 |
|
public function getFilenameForLog($uniqueId) |
|
38
|
|
|
{ |
|
39
|
27 |
|
return $this->getTempFilename('logs', $uniqueId, '.json.log'); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @param string $uniqueId |
|
44
|
|
|
* @return string |
|
45
|
|
|
*/ |
|
46
|
2 |
|
public function getFilenameForCoverage($uniqueId) |
|
47
|
|
|
{ |
|
48
|
2 |
|
return $this->getTempFilename('coverage', $uniqueId, '.php'); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @return string |
|
53
|
|
|
*/ |
|
54
|
12 |
|
public function getFilenameForConfiguration() |
|
55
|
|
|
{ |
|
56
|
12 |
|
return $this->getTempFilename('config', 'phpunit', '.xml.dist'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @param string $filename |
|
61
|
|
|
* @param string $extension |
|
62
|
|
|
* @return string |
|
63
|
|
|
*/ |
|
64
|
30 |
|
private function getTempFilename($subdir, $filename, $extension) |
|
65
|
|
|
{ |
|
66
|
30 |
|
return $this->tempDirectory->getTempDirForThisExecution() |
|
67
|
30 |
|
. DIRECTORY_SEPARATOR |
|
68
|
30 |
|
. $subdir |
|
69
|
30 |
|
. DIRECTORY_SEPARATOR |
|
70
|
30 |
|
. $filename |
|
71
|
30 |
|
. $extension; |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|