Running Laravel’s Own Tests

After some exploring here are the steps to get Laravel Framework‘s own tests passing on Ubuntu Linux, or Window’s WSL2, with PHP 7.4:

# For older releases without PHP 7.4
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

# Install library and server dependencies
sudo apt-get install \
  memcached \
  php7.4 \
  php7.4-dev \
  php7.4-dom \
  php7.4-mbstring \
  php7.4-memcached \
  php7.4-mysql \
  php7.4-odbc \
  php7.4-pdo \
  php7.4-sqlite \

# Start local servers that tests rely on
sudo /etc/init.d/redis-server start
sudo /etc/init.d/memcached start

# Change directory to the framework or fork folder
cd framework

# Copy the test configuration
cp phpunit.xml.dist phpunit.xml
# Remove comments around Redis settings
sed --in-place --regexp-extended \
  --expression='s/(<!--|-->)//g' phpunit.xml

# Install PHP dependencies
composer update --prefer-lowest \
  --prefer-dist \
  --prefer-stable \

After all that it should be possible to run the tests with ./vendor/bin/phpunit. Then the usual flags can help to run ones own tests like --filter testMyNewFeature.

Leave a Reply

Your email address will not be published. Required fields are marked *