-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting up a fresh start for unit tests
- Loading branch information
1 parent
ac4c3fb
commit f3f97b9
Showing
5 changed files
with
24 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
<?php | ||
|
||
// First we need to load the composer autoloader, so we can use WP Mock | ||
require_once dirname( __DIR__ ) . '../../vendor/autoload.php'; | ||
if ( false === getenv( 'WP_TESTS_DIR' ) ) { | ||
exit( 'WP_TESTS_DIR environment variable is not set. Please set it to the root of your WordPress installation.' ); | ||
} | ||
|
||
define( 'TESTS_PLUGIN_DIR', dirname( __DIR__, 2 ) ); | ||
|
||
if ( ! file_exists( TESTS_PLUGIN_DIR . '/vendor/autoload.php' ) ) { | ||
exit( 'The vendor directory is missing. Please run composer install.' ); | ||
} | ||
|
||
require TESTS_PLUGIN_DIR . '/vendor/autoload.php'; | ||
|
||
$_test_root = getenv( 'WP_TESTS_DIR' ); | ||
|
||
if ( ! file_exists( $_test_root . '/includes/bootstrap.php' ) ) { | ||
exit( 'Could not load /includes/bootstrap.php' ); | ||
} | ||
|
||
require $_test_root . '/includes/bootstrap.php'; |