Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPUnit Cleanup - Fixes #2053 #2054

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
43 changes: 43 additions & 0 deletions tests/TestListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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 <[email protected]>
*/
class TestListener extends PHPUnit_Framework_BaseTestListener
{
/**
* A test suite ended.
*
* @since Method available since Release 2.2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this.

*
* @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/*.php') as $file) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should clear the cachet cache folder too.

unlink($file);
}
}
}