In the interest of keeping our project up-to-date and to take advantage of new development, we updated from Laravel 5.1 to 5.2 yesterday. After massaging our codebase for a few hours, everything seems to run as normal, except now the PHPUnit tests we have used extensively in 5.1 have now stopped. PHPUnit shows the first line to show it has initialised:
PHPUnit 4.8.24 by Sebastian Bergmann and contributors.
But then freezes indefinitely. I've tried upgrading to a later version of PHPUnit (we were using 4.2.24, and I tried moving to 5.3.2, but with the same results).
There are no errors in the log unfortunately. I tried to remove all the tests to make sure PHPUnit runs without any tests, and it does so:
Time: 2.19 seconds, Memory: 4.25Mb
No tests executed!
This indicates that there might be something in my tests somewhere causing it, but I've gone right down to removing everything but a single test and the issue remains.
Does anyone know what might cause this in moving from 5.1 to 5.2? How would one go about debugging and getting these tests to run again?
We're using PHP version 5.6.13.
Config, for what it's worth:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">app/</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>
For you poor souls who get caught up in more Laravel madness, the issue here was that some configuration changed in 5.1 to 5.2. In frustration, I rebuilt my config from the bottom up and things started to work again. Here's what I did:
.env.testing. Mine looks somewhat like this:
DB_CONNECTION="testing"
DB_HOST=localhost
DB_DATABASE=something_tests
DB_USERNAME=username
DB_PASSWORD=password
APP_DEBUG="true"
phpunit.xml file, in the <php> section, add <env name="APP_ENV" value="testing"/>, so it points to the aforementioned file.config/database.php file and make sure the DB_CONNECTION is defined and correct.Once you're done, do the usual php artisan config:clear. I've also found that sometimes my testing database gets messed up if some tests fail during development, so occasionally I need to blast the whole thing away and rebuild.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With