Total Complexity | 5 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | trait TestHelperTrait |
||
14 | { |
||
15 | protected static string $strSQLiteDBFilename = 'testdb.sqlite'; |
||
16 | |||
17 | protected function loadSubscription(string $strFilename) : string |
||
18 | { |
||
19 | return file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'testdata' . DIRECTORY_SEPARATOR . $strFilename); |
||
20 | } |
||
21 | |||
22 | protected static function getTempDataDir() : string |
||
23 | { |
||
24 | $strTmpDir = __DIR__ . DIRECTORY_SEPARATOR . 'tempdata'; |
||
25 | if (!file_exists($strTmpDir)) { |
||
26 | mkdir($strTmpDir); |
||
27 | } |
||
28 | chmod($strTmpDir, 0777); |
||
29 | return $strTmpDir; |
||
30 | } |
||
31 | |||
32 | protected static function deleteTempDataFile() : void |
||
33 | { |
||
34 | $strFullPath = self::getTempDataDir() . DIRECTORY_SEPARATOR . self::$strSQLiteDBFilename; |
||
35 | if (file_exists($strFullPath)) { |
||
36 | unlink($strFullPath); |
||
37 | } |
||
39 | } |