From a7a555e9890b995ca9fc119a38046b331bc891f6 Mon Sep 17 00:00:00 2001 From: "Connor S. Parks" Date: Sat, 13 Aug 2016 17:05:17 +0100 Subject: [PATCH] Adds cleanup after phpunit is finished, fixes #2053 (#2055) --- phpunit.xml.dist | 3 +++ tests/TestListener.php | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/TestListener.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index bb28c109..46128987 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -25,6 +25,9 @@ ./app + + + diff --git a/tests/TestListener.php b/tests/TestListener.php new file mode 100644 index 00000000..b92cfb5b --- /dev/null +++ b/tests/TestListener.php @@ -0,0 +1,41 @@ + + */ +class TestListener extends PHPUnit_Framework_BaseTestListener +{ + /** + * A test suite ended. + * + * @param \PHPUnit_Framework_TestSuite $suite + * + * @return void + */ + public function endTestSuite(PHPUnit_Framework_TestSuite $suite) + { + if ($suite->getName() !== 'Cachet Test Suite') { + return; + } + + foreach (glob(__DIR__.'/../bootstrap/cache{,t}/*.php', GLOB_BRACE) as $file) { + unlink($file); + } + } +}