- Get local by flywheel
- Add a new local site
- Custom install
- PHP 7.3
- nginx
- Mysql 5.6
- WP user: admin
- WP password: admin
- Go to WP admin
- Install and activate the plugin you would like to test
- SSH into the site and run these commands:
- 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-tests contact-form-7-conditional-fields-pro
- cd wp-content/plugins/contact-form-7-conditional-fields-pro/
- bin/install-wp-tests.sh wordpress_test root ‘root’ localhost latest
- Edit the file tests/bootsrap.php at line 25
-
function _manually_load_plugin() { require dirname( dirname( __FILE__ ) ) . '/contact-form-7-conditional-fields.php'; }
-
- Edit the file phpunit.xml.dist:
-
<?xml version="1.0"?> <phpunit bootstrap="tests/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" > <testsuites> <testsuite name="wptest"> <directory prefix="test-" suffix=".php">./tests/</directory> </testsuite> </testsuites> </phpunit>
-