Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Add an option in phpunit config to clear the cache before tests are run #421

Closed
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
8 changes: 7 additions & 1 deletion app/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
processIsolation = "false"
stopOnFailure = "false"
syntaxCheck = "false"
bootstrap = "bootstrap.php.cache" >
bootstrap = "tests.bootstrap.php" >

<testsuites>
<testsuite name="Project Test Suite">
Expand All @@ -26,6 +26,12 @@
</php>
-->

<!--
<php>
<env name="BOOTSTRAP_CLEAR_CACHE_ENV" value="test"/>
</php>
-->

<filter>
<whitelist>
<directory>../src</directory>
Expand Down
7 changes: 7 additions & 0 deletions app/tests.bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

if (isset($_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'])) {
passthru(sprintf('php "%s" cache:clear --env=%s --no-warmup', __DIR__.'/console', $_ENV['BOOTSTRAP_CLEAR_CACHE_ENV']));
}

return require __DIR__.'/bootstrap.php.cache';