,

WordPress site/theme tests

By.

min read

My profile

Share this:

Install

Create empty DB, example: wordpress_test

Theme:

wp-cli scaffold theme-tests yourthemename

App:

composer require --dev yoast/phpunit-polyfills:"^3.0"

How to run

In your theme, once per startup

bash bin/install-wp-tests.sh wordpress_test dbusername dbpassword localhost latest

Run the tests

../../../vendor/bin/phpunit

Fix issues

In yourthemename/tests/bootstrap.php you might need to add and/or force (pre-)overwrite defines:

define( 'DB_NAME', 'wordpress_test' );
require '/home/mylinuxusername/www/projectname/web/vendor/autoload.php';
require '/home/mylinuxusername/www/projectname/web/config/application.php';

Share this:

Leave a Reply

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