Skip to content

Commit f8e3fbb

Browse files
committed
test: fix issue where test broke if you ran phpunit from the project directory instead of globally
1 parent 370bdad commit f8e3fbb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/bootstrap.php

+7
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ function( $message ) {
7373
// Start up the WP testing environment.
7474
require $_tests_dir . '/includes/bootstrap.php';
7575

76+
// If PHPUnit is run from the project directory, it loads the themeisle SDK via the composer autoload file at the
77+
// beginning of the script execution. This is too early because the SDK needs WordPress to be loaded. This code checks
78+
// if the SDK was actually loaded and forces it to load again if it wasn't loaded properly.
79+
if ( ! function_exists( 'tsdk_translate_link' ) ) {
80+
require __DIR__ . '/../vendor/codeinwp/themeisle-sdk/load.php';
81+
}
82+
7683
// Activate Optimole plugin
7784
activate_plugin( 'optimole-wp/optimole-wp.php' );
7885

0 commit comments

Comments
 (0)