-
-
Notifications
You must be signed in to change notification settings - Fork 495
Remove debug for default PHPUnit config #242
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
Conversation
fabpot
commented
Nov 8, 2017
Q | A |
---|---|
License | MIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
Running tests in no-debug mode has the benefit of running tests much faster (as you don't need to check the cache freshness in each test, while the code would not have changed). Here is how I solved it at Incenteev: namespace Incenteev\Tests\Util;
use Symfony\Component\Filesystem\Filesystem;
class CacheClearer
{
public function clearCache()
{
if (getenv('INCENTEEV_KEEP_CACHE')) {
return;
}
$filesystem = new Filesystem();
$filesystem->remove($this->getCacheFolders());
}
private function getCacheFolders()
{
return array(
__DIR__.'/../../../var/api-cache/test',
__DIR__.'/../../../var/api-cache/behat',
__DIR__.'/../../../var/cache/test',
__DIR__.'/../../../var/cache/behat',
);
}
} And then, my PHPUnit bootstrap script is this: require __DIR__.'/../app/autoload.php';
(new \Incenteev\Tests\Util\CacheClearer())->clearCache(); This ensures that a developer running tests locally does not have a stale cache (the env variable |
There is another issue with enabling debug, and that's a bunch of logs on the console. Maybe that should be fixed as well. /cc @dunglas |
@fabpot maybe can we just remove the |
@dunglas Makes sense. How is it configured for the console (do we have the same issue)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
Just by using this and enabling debug mode manually in certain tests (that need profiler or that test debug-related services) I made my tests run 3 times faster 👍 |
@dunglas Having logs entangled with some "real" output always looks like a bug to me. |
What about setting the SHELL_VERBOSITY env var instead? |
closing in favor of #281 |