Description
Locate the wordpress-develop-tests codeWe're trying to find the path to the wordpress-develop-tests plugin or the "tests\phpunit" directory within an extract from SVN or git. Use these methods to locate the code:
- wordpress-develop-tests installed as a plugin.
- `WP_DEVELOP_DIR` environment variable – used by Jetpack
- `WP_TESTS_DIR` environment variable – used by CMB2
- Plugin installed inside of WordPress.org developer checkout
- Tests checked out to /tmp
C:\svn \wordpress-develop \src \wp-content \plugins \oik-batch - oik-wp.php \tests - bootstrap.php \$plugin \tests - test-*.php \wordpress-develop-tests same directory structure as \tests below \tests \phpunit \build \data \includes - functions.php and other required files \testsBTW: Apologies for using Windows backslashes
Usage
$string|null = locate_wordpress_develop_tests();Parameters
Returns
string|null the directory root for the tests filesSource
File name: oik-batch/tests/bootstrap.phpLines:
1 to 17 of 17
function locate_wordpress_develop_tests() { $test_root = locate_wordpress_develop_tests_plugin(); if ( $test_root ) { echo "Using wordpress-develop-tests plugin" . PHP_EOL; } elseif ( false !== getenv( 'WP_DEVELOP_DIR' ) ) { $test_root = getenv( 'WP_DEVELOP_DIR' ); } elseif ( false !== getenv( 'WP_TESTS_DIR' ) ) { $test_root = getenv( 'WP_TESTS_DIR' ); } elseif ( file_exists( '../../../../tests/phpunit/includes/bootstrap.php' ) ) { $test_root = '../../../../tests/phpunit'; } elseif ( file_exists( '/tmp/wordpress-tests-lib/includes/bootstrap.php' ) ) { $test_root = '/tmp/wordpress-tests-lib'; } else { echo "WordPress develop tests bootstrap.php not found" . PHP_EOL; } return( $test_root ); }View on GitHub
