CI for Laravel

Testing with PHPUnit

Chipper CI doesn't install phpunit into the build container! That's because most projects include phpunit within their dev dependencies.

PHPUnit is Probably Already Available

Your project likely has phpunit installed at ./vendor/bin/phpunit. Chipper CI sets $PATH to include ./vendor/bin in directory, so your test script can often be as simple as:

# Test with either phpunit or laravel's "test" command

php artisan test

Parallel Testing

Laravel supports running tests in parallel. To do this, Laravel will create (and destroy) databases dynamically.

The chipperci database user may not have permission to do this out of the box. To allow it, use the following command in your pipeline, before running tests:

mysql -e "grant all privileges on *.* to chipperci@'%' with grant option;"

Install PHPUnit (if you need to)

If you need to, you can install phpunit like this:

# Install phpunit 9
wget -O phpunit
chmod +x phpunit

# Run it!