| 1 | <?php |
||
| 6 | class Acceptance extends \Codeception\Module |
||
| 7 | { |
||
| 8 | public function _initialize() |
||
| 9 | { |
||
| 10 | $this->clearDownloadDir(); |
||
| 11 | } |
||
| 12 | |||
| 13 | private function clearDownloadDir() |
||
| 14 | { |
||
| 15 | $downloadDir = dirname(__DIR__) . '/_downloads/'; |
||
| 16 | if (file_exists($downloadDir)) { |
||
| 17 | $files = scandir($downloadDir); |
||
| 18 | $files = array_filter($files, function ($fileName) use ($downloadDir) { |
||
| 19 | return is_file($downloadDir.$fileName) && (strpos($fileName, '.') != 0); |
||
| 20 | }); |
||
| 21 | foreach ($files as $f) { |
||
| 22 | unlink($downloadDir.$f); |
||
| 23 | } |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | public function getBaseUrl() |
||
| 28 | { |
||
| 29 | return $this->getModule('WebDriver')->_getUrl(); |
||
| 30 | } |
||
| 31 | } |
||
| 32 |