Adds cleanup after phpunit is finished, fixes #2053 (#2055)

This commit is contained in:
Connor S. Parks
2016-08-13 17:05:17 +01:00
committed by Graham Campbell
parent 2348bdb780
commit a7a555e989
2 changed files with 44 additions and 0 deletions

View File

@@ -25,6 +25,9 @@
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<listeners>
<listener class="CachetHQ\Tests\Cachet\TestListener" file="./tests/TestListener.php" />
</listeners>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_DEBUG" value="true"/>

41
tests/TestListener.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Tests\Cachet;
use PHPUnit_Framework_BaseTestListener;
use PHPUnit_Framework_TestSuite;
/**
* This is the test listener class.
*
* @author Connor S. Parks <connor@connorvg.tv>
*/
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);
}
}
}