Skip to content

Commit a7a555e

Browse files
ConnorVGGrahamCampbell
authored andcommittedAug 13, 2016
Adds cleanup after phpunit is finished, fixes #2053 (#2055)
1 parent 2348bdb commit a7a555e

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
 

‎phpunit.xml.dist

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<directory suffix=".php">./app</directory>
2626
</whitelist>
2727
</filter>
28+
<listeners>
29+
<listener class="CachetHQ\Tests\Cachet\TestListener" file="./tests/TestListener.php" />
30+
</listeners>
2831
<php>
2932
<env name="APP_ENV" value="testing"/>
3033
<env name="APP_DEBUG" value="true"/>

‎tests/TestListener.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet;
13+
14+
use PHPUnit_Framework_BaseTestListener;
15+
use PHPUnit_Framework_TestSuite;
16+
17+
/**
18+
* This is the test listener class.
19+
*
20+
* @author Connor S. Parks <connor@connorvg.tv>
21+
*/
22+
class TestListener extends PHPUnit_Framework_BaseTestListener
23+
{
24+
/**
25+
* A test suite ended.
26+
*
27+
* @param \PHPUnit_Framework_TestSuite $suite
28+
*
29+
* @return void
30+
*/
31+
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
32+
{
33+
if ($suite->getName() !== 'Cachet Test Suite') {
34+
return;
35+
}
36+
37+
foreach (glob(__DIR__.'/../bootstrap/cache{,t}/*.php', GLOB_BRACE) as $file) {
Has a conversation. Original line has a conversation.
38+
unlink($file);
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)
Please sign in to comment.