- Contributors: bobbingwide
- Donate link: https://www.oik-plugins.com/oik/oik-donate/
- Tags: PHPUnit, automated, testing
- Requires at least: 5.5
- Tested up to: 5.9.3
- Stable tag: 5.9.3
- License: GPLv2 or later
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
- Text Domain: default
- Domain Path: /languages/
Automated testing of WordPress involves running test cases where manual intervention is not required to run each one.
- WordPress is a complicated system.
- There aren't as many tests as you might have hoped.
- But the team are working on it.
- Each new TRAC could/should be backed up by a new test.
The purpose of this plugin is twofold:
- To allow the WP-a2z dynamic API reference parser to be run against the PHPUnit tests for WordPress. Developers can then view the tests and navigate through them as if they were a real plugin.
- To provide the framework functionality for in situ PHPUnit testing of plugins and themes using oik-batch.
- Only intended for installation into a WordPress environment where you'll be running your own PHPUnit tests.
- The zip file is built from the tests folder of the wordpress-develop SVN repository.
Nothing as a plugin. You have to invoke the tests using PHPUnit.
From v4.9.1 we provide a modified version of the phpunit.xml file so that you can attempt to run the WordPress core tests in situ.
- We'll be running the tests in a Windows 10 environment using PHP 7.4 and maybe PHP 7.3.
- The configuration file is different from the one delivered in WordPress core.
-
- Note: The tests do not run to completion. That is, they don't actually work when run in situ.
Testsuites The primary directory is different. You run the tests from the plugin directory, Instead of being called tests/phpunit/tests the directory is phpunit/tests
We expect PHP 7.2 - 7.4 so there's no need for the exclude sections
<testsuites>
<!-- Default test suite to run all tests -->
<testsuite>
<directory suffix=".php">tests/phpunit/tests</directory>
<exclude>tests/phpunit/tests/actions/closures.php</exclude>
<exclude>tests/phpunit/tests/image/editor.php</exclude>
<exclude>tests/phpunit/tests/image/editorGd.php</exclude>
<exclude>tests/phpunit/tests/image/editorImagick.php</exclude>
<exclude>tests/phpunit/tests/oembed/headers.php</exclude>
<file phpVersion="5.3.0">tests/phpunit/tests/actions/closures.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/image/editor.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/image/editorGd.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/image/editorImagick.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/oembed/headers.php</file>
</testsuite>
Groups - the exclusion list is the same.
<groups>
<exclude>
<group>ajax</group>
<group>ms-files</group>
<group>ms-required</group>
<group>external-http</group>
</exclude>
</groups>
Logging - There's no logging section.
<logging>
<log type="junit" target="tests/phpunit/build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
We control it from the command line.
Listeners - There's no listener section
<listeners>
<listener class="SpeedTrapListener" file="tests/phpunit/includes/speed-trap-listener.php">
<arguments>
<array>
<element key="slowThreshold">
<integer>150</integer>
</element>
</array>
</arguments>
</listener>
</listeners>
Filter - There's no filter section - since we don't do code coverage
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
PHP const - same as for core
If you activate the plugin then nothing is expected to happen since it doesn't contain any code.
If you run PHPUnit then quite a lot might happen.
And if you had happened to configure your database the same as your live site then you could destroy your live site. But probably not completely!
I'm sure you could try to do this but I can't see why you'd want to.
Use this plugin in combination with oik-batch
From WordPress 5.9 and above the only version supported is PHPUnit 9.
In the same way that WP-a2z.org helps you to develop WordPress code this provides you with a dynamic reference of current tests. See develop.wp-a2z.org
Yes. oik-plugins are PHPUnit tested using in situ testing. See How to run PHPUnit tests for WordPress plugins in situ
- Method: March/April 2022
- As for August 2020
- Plus, update the main plugin file ( wordpress-develop-gtests.php ) to set the new version number.
- Method: August 2020
- Install the WordPress Git mirror. See commands below.
- Change directory to a clone of the GitHub repository bobbingwide/wordpress-develop-tests
- Remove the phpunit and qunit directories
- Copy files from the tests folder, phpunit and qunit
- update the readme.txt file
- Commit changes, including any deletions
- Push to GitHub
- Pull into the WP-a2z websites plugin directory
- Build the dynamic API reference for the latest level
cd \github\wordpress
git clone https://github.com/WordPress/wordpress-develop
- Method: Nov 2019
- Extract https://develop.svn.wordpress.org/tags/5.3 to c:\svn\wordpress-develop\5.3
cd \svn\wordpress-develop
svn co https://develop.svn.wordpress.org/tags/5.3
- remaining steps as August 2016
- Method: Oct 2019
- Extract https://develop.svn.wordpress.org/tags/5.2.3 to c:\svn\wordpress-develop\5.2.3
cd \svn\wordpress-develop
svn co https://develop.svn.wordpress.org/tags/5.2.3
- remaining steps as August 2016
- Method: Dec 2018
- Extract https://develop.svn.wordpress.org/tags/5.0 to c:\svn\wordpress-develop\5.0
cd \svn\wordpress-develop
svn co https://develop.svn.wordpress.org/tags/5.0
- remaining steps as August 2016
- Method: May 2018
- Extract http://develop.svn.wordpress.org/tags/4.9.6 to c:\svn\wordpress-develop\4.9.6
cd \svn\wordpress-develop
svn co http://develop.svn.wordpress.org/tags/4.9.6
- remaining steps as August 2016
- Method: November 2017
- Extract http://develop.svn.wordpress.org/tags/4.9 to c:\svn\wordpress-develop\4.9
cd \svn\wordpress-develop
svn co http://develop.svn.wordpress.org/tags/4.9
- remaining steps as August 2016
- Method: August 2017
- Extract http://develop.svn.wordpress.org/tags/4.8.1 to c:\svn\wordpress-develop\4.8.1
- remaining steps as August 2016
- Method: June 2017
- Extract http://develop.svn.wordpress.org/trunk to C:\svn\wordpress-develop
- remaining steps as August 2016
- Method: March 2017
- Extract http://develop.svn.wordpress.org/tags/4.7.3 to c:\svn\wordpress-develop\4.7.3
- remaining steps as August 2016
- Method: December 2016
- Extract http://develop.svn.wordpress.org/branch/4.7 to C:\svn\wordpress-develop\4.7
- remaining steps as August 2016
- Method: August 2016
This is the latest process used to build the API reference.
- Extract http://develop.svn.wordpress.org/trunk to C:\svn\wordpress-develop
- Change directory to a clone of the GitHub repository bobbingwide/wordpress-develop-tests
- Remove the phpunit and qunit directories
- Copy files from the tests folder, phpunit and qunit
- update the readme.txt file
- Commit changes, including any deletions
- Push to GitHub
- Pull into the WP-a2z websites plugin directory
- Build the dynamic API reference for the latest level
- Original method: Nov 2014
To get WP-A2z to work locally I simply created a symbolic link from the latest SVN version to a plugin directory.
cd wp-content/plugins mklink /J wordpress-develop-tests svn\wordpress-develop\tests
- None
Built from https://github.com/WordPress/wordpress-develop ( on 2022/03/20 ) Now requires PHPUnit 9.
Built from https://github.com/WordPress/wordpress-develop ( on 2020/08/30 )
Built from https://develop.svn.wordpress.org/tags/5.3 ( on 2019/11/26 )
Now requires PHPUnit 8. Built from https://develop.svn.wordpress.org/tags/5.2.3 ( on 2019/10/09 )
Built from https://develop.svn.wordpress.org/tags/5.0 ( on 2018/12/07 )
Built from http://develop.svn.wordpress.org/tags/4.9.6 ( on 2018/05/27 )
Built from http://develop.svn.wordpress.org/tags/4.9 ( on 2017/11/16 )
Built from http://develop.svn.wordpress.org/tags/4.8.3 ( on 2017/08/04 )
Built from http://develop.svn.wordpress.org/trunk ( on 2017/06/02 )
Built from http://develop.svn.wordpress.org/tags/4.7.3 (on 2017/03/12 )
Built from http://develop.svn.wordpress.org/branch/4.7 (on 2016/12/07 )
Built from an SVN extract of trunk taken 2016/08/19
Built from an SVN extract of trunk taken 2016/07/07
Built from an update performed on 20 Nov 2014
- New build from revision 30427 - WordPress 4.0.?
- Changed: Source files updated to version from Git clone
- Tested: With PHPUnit 8.5.1
- Tested: With WordPress 5.5 and 5.5.1-RC1
- Tested: With PHP 7.4
- Changed: Source files updated to tags/5.3
- Tested: With PHPUnit 8.4.1
- Tested: With WordPress 5.3
- Tested: With PHP 7.3
- Changed: Source files updated to tags/5.2.3
- Tested: With PHPUnit 8.4.1
- Tested: With WordPress 5.2.3
- Tested: With PHP 7.3
- Changed: Source files updated to tags/5.0
- Tested: With PHPUnit 6.5
- Tested: With WordPress 5.0
- Tested: With PHP 7.2
- Changed: Source files updated to tags/4.9.6
- Changed: Updated readme, noting that in situ PHPUnit tests don't actually work
- Tested: With PHPUnit 6.2
- Tested: With PHP 7.1 and 7.2
- Tested: With WordPress 4.9.6 and WordPress Multisite
- Changed: Incomplete change to attempt to run PHPUnit tests in situ.
- Changed: Source files updated to tags/4.9
- Changed: Updated readme
- Tested: With PHPUnit 6.1
- Tested: With PHP 7.0 and 7.1
- Tested: With WordPress 4.9 and WordPress Multisite
- Changed: Source files updated to tags/4.8.3
- Changed: Updated readme
- Tested: With PHPUnit 6.1
- Tested: With PHP 7.0 and 7.1
- Tested: With WordPress 4.8 and 4.8.1
- Changed: Source files updated to version in /trunk = 4.9-alpha-40870-src
- Changed: updated readme
- Tested: With PHPUnit 6.1 and 5.7.
- Changed: Source files updated to tags/4.7.3
- Changed: updated readme
- Deleted: phpunit/tests/user/wpSetCurrentUserhm.php - again, not part of WordPress tests
- Changed: source files updated to branch/4.7
- Changed: updated readme
- Deleted: Unnecessary phpunit/build and phpunit/data files - accidentally checked in for 4.5.3
- Deleted: phpunit/tests/user/wpSetCurrentUserhm.php - not part of WordPress tests
- Changed: source files updated to latest extract taken on 2016/08/19
- Fixed: Removed unnecessary .idea files
- Changed: source files updated to latest extract taken on 2016/07/07
- Changed: readme should reflect the new build process
- Fixed: Some files were corrupted with local changes 2016/07/09
- Changed: See SVN repository for the change log of the tests
- Added: New for develop.wp-a2z.org
Extract the latest version of WordPress developer from
https://develop.svn.wordpress.org/trunk/
This will also extract the latest version of the source.
Read about: