Skip to content

Commit 8a90221

Browse files
Configure cache directory
1 parent 6565fa7 commit 8a90221

11 files changed

+90
-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 <sebastian@phpunit.de>
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/code-coverage/ignore-class-using-attribute-process-isolation.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ $_SERVER['argv'][] = '--coverage-filter';
1616
$_SERVER['argv'][] = __DIR__ . '/ignore-class-using-attribute/src';
1717
$_SERVER['argv'][] = '--coverage-text';
1818
$_SERVER['argv'][] = __DIR__ . '/ignore-class-using-attribute/tests';
19+
$_SERVER['argv'][] = '--cache-directory';
20+
$_SERVER['argv'][] = __DIR__ . '/ignore-class-using-attribute/cache';
1921

2022
require_once __DIR__ . '/../../bootstrap.php';
2123

2224
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
25+
--CLEAN--
26+
<?php declare(strict_types=1);
27+
require __DIR__ . '/../../_files/delete_directory.php';
28+
29+
delete_directory(__DIR__ . '/ignore-class-using-attribute/cache');
2330
--EXPECTF--
2431
PHPUnit %s by Sebastian Bergmann and contributors.
2532

tests/end-to-end/code-coverage/ignore-class-using-attribute.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@ $_SERVER['argv'][] = '--coverage-filter';
1515
$_SERVER['argv'][] = __DIR__ . '/ignore-class-using-attribute/src';
1616
$_SERVER['argv'][] = '--coverage-text';
1717
$_SERVER['argv'][] = __DIR__ . '/ignore-class-using-attribute/tests';
18+
$_SERVER['argv'][] = '--cache-directory';
19+
$_SERVER['argv'][] = __DIR__ . '/ignore-class-using-attribute/cache';
1820

1921
require_once __DIR__ . '/../../bootstrap.php';
2022

2123
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
24+
--CLEAN--
25+
<?php declare(strict_types=1);
26+
require __DIR__ . '/../../_files/delete_directory.php';
27+
28+
delete_directory(__DIR__ . '/ignore-class-using-attribute/cache');
2229
--EXPECTF--
2330
PHPUnit %s by Sebastian Bergmann and contributors.
2431

tests/end-to-end/code-coverage/ignore-function-using-attribute-process-isolation.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ $_SERVER['argv'][] = '--coverage-filter';
1616
$_SERVER['argv'][] = __DIR__ . '/ignore-function-using-attribute/src';
1717
$_SERVER['argv'][] = '--coverage-text';
1818
$_SERVER['argv'][] = __DIR__ . '/ignore-function-using-attribute/tests';
19+
$_SERVER['argv'][] = '--cache-directory';
20+
$_SERVER['argv'][] = __DIR__ . '/ignore-function-using-attribute/cache';
1921

2022
require_once __DIR__ . '/../../bootstrap.php';
2123

2224
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
25+
--CLEAN--
26+
<?php declare(strict_types=1);
27+
require __DIR__ . '/../../_files/delete_directory.php';
28+
29+
delete_directory(__DIR__ . '/ignore-function-using-attribute/cache');
2330
--EXPECTF--
2431
PHPUnit %s by Sebastian Bergmann and contributors.
2532

tests/end-to-end/code-coverage/ignore-function-using-attribute.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@ $_SERVER['argv'][] = '--coverage-filter';
1515
$_SERVER['argv'][] = __DIR__ . '/ignore-function-using-attribute/src';
1616
$_SERVER['argv'][] = '--coverage-text';
1717
$_SERVER['argv'][] = __DIR__ . '/ignore-function-using-attribute/tests';
18+
$_SERVER['argv'][] = '--cache-directory';
19+
$_SERVER['argv'][] = __DIR__ . '/ignore-function-using-attribute/cache';
1820

1921
require_once __DIR__ . '/../../bootstrap.php';
2022

2123
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
24+
--CLEAN--
25+
<?php declare(strict_types=1);
26+
require __DIR__ . '/../../_files/delete_directory.php';
27+
28+
delete_directory(__DIR__ . '/ignore-function-using-attribute/cache');
2229
--EXPECTF--
2330
PHPUnit %s by Sebastian Bergmann and contributors.
2431

tests/end-to-end/code-coverage/ignore-method-using-attribute-process-isolation.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ $_SERVER['argv'][] = '--coverage-filter';
1616
$_SERVER['argv'][] = __DIR__ . '/ignore-method-using-attribute/src';
1717
$_SERVER['argv'][] = '--coverage-text';
1818
$_SERVER['argv'][] = __DIR__ . '/ignore-method-using-attribute/tests';
19+
$_SERVER['argv'][] = '--cache-directory';
20+
$_SERVER['argv'][] = __DIR__ . '/ignore-method-using-attribute/cache';
1921

2022
require_once __DIR__ . '/../../bootstrap.php';
2123

2224
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
25+
--CLEAN--
26+
<?php declare(strict_types=1);
27+
require __DIR__ . '/../../_files/delete_directory.php';
28+
29+
delete_directory(__DIR__ . '/ignore-method-using-attribute/cache');
2330
--EXPECTF--
2431
PHPUnit %s by Sebastian Bergmann and contributors.
2532

tests/end-to-end/code-coverage/ignore-method-using-attribute.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@ $_SERVER['argv'][] = '--coverage-filter';
1515
$_SERVER['argv'][] = __DIR__ . '/ignore-method-using-attribute/src';
1616
$_SERVER['argv'][] = '--coverage-text';
1717
$_SERVER['argv'][] = __DIR__ . '/ignore-method-using-attribute/tests';
18+
$_SERVER['argv'][] = '--cache-directory';
19+
$_SERVER['argv'][] = __DIR__ . '/ignore-method-using-attribute/cache';
1820

1921
require_once __DIR__ . '/../../bootstrap.php';
2022

2123
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
24+
--CLEAN--
25+
<?php declare(strict_types=1);
26+
require __DIR__ . '/../../_files/delete_directory.php';
27+
28+
delete_directory(__DIR__ . '/ignore-method-using-attribute/cache');
2229
--EXPECTF--
2330
PHPUnit %s by Sebastian Bergmann and contributors.
2431

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

tests/end-to-end/regression/5218.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ $_SERVER['argv'][] = '--coverage-filter';
1616
$_SERVER['argv'][] = __DIR__ . '/5218/src/';
1717
$_SERVER['argv'][] = '--coverage-text';
1818
$_SERVER['argv'][] = __DIR__ . '/5218/tests/';
19+
$_SERVER['argv'][] = '--cache-directory';
20+
$_SERVER['argv'][] = __DIR__ . '/5218/cache';
1921

2022
require_once __DIR__ . '/../../bootstrap.php';
2123

2224
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
25+
--CLEAN--
26+
<?php declare(strict_types=1);
27+
require __DIR__ . '/../../_files/delete_directory.php';
28+
29+
delete_directory(__DIR__ . '/5218/cache');
2330
--EXPECTF--
2431
PHPUnit %s by Sebastian Bergmann and contributors.
2532

0 commit comments

Comments
 (0)