Run the following commands in order:
apt-get update
apt-get install curl
apt-get install subversion
wget -O phpunit https://phar.phpunit.de/phpunit-7.phar
chmod +x phpunit
mv phpunit /usr/local/bin/phpunit
curl -s https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
cd /app/public
composer require --dev phpunit/phpunit ^7
wp scaffold plugin-test <plugin directory name>
cd wp-content/plugins/<plugin directory name>
bin/install-wp-tests.sh wordpress_test root 'root' localhost latest
Add name
attribute on testsuite
element in phpunit.xml.dist
file:
<?xml version="1.0"?>
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<testsuites>
<testsuite name="<plugin directory name>">
<directory prefix="test-" suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>