Skip to content

Commit f3c5487

Browse files
Clean up after test
1 parent 52c87f2 commit f3c5487

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

tests/_files/delete_directory.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
function delete_directory(string $directory): void
11+
{
12+
if (\is_file($directory)) {
13+
@\unlink($directory);
14+
15+
return;
16+
}
17+
18+
if (!\is_dir($directory)) {
19+
return;
20+
}
21+
22+
foreach (\glob(\rtrim($directory, '/') . '/*') as $path) {
23+
delete_directory($path);
24+
}
25+
26+
@\rmdir($directory);
27+
}

tests/end-to-end/event/_files/invalid-coverage-metadata/phpunit.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="../../../../../phpunit.xsd">
3+
xsi:noNamespaceSchemaLocation="../../../../../phpunit.xsd"
4+
cacheDirectory=".phpunit.cache">
45
<testsuites>
56
<testsuite name="default">
67
<directory>tests</directory>

tests/end-to-end/event/invalid-coverage-metadata.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ $_SERVER['argv'][] = '--debug';
1616
require __DIR__ . '/../../bootstrap.php';
1717

1818
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
19+
--CLEAN--
20+
<?php declare(strict_types=1);
21+
require __DIR__ . '/../../_files/delete_directory.php';
22+
23+
delete_directory(__DIR__ . '/_files/invalid-coverage-metadata/.phpunit.cache');
1924
--EXPECTF--
2025
PHPUnit Started (PHPUnit %s using %s)
2126
Test Runner Configured

0 commit comments

Comments
 (0)