<commit_before><?php
/**
 * Bootstrap Unit Tests
 *
 * @author <NAME>
 * @since  1.0
 */

$_tests_dir = getenv( 'WP_TESTS_DIR' );

if ( ! $_tests_dir ) {
	$_tests_dir = '/tmp/wordpress-tests-lib';
}
require_once $_tests_dir . '/includes/functions.php';

$_SERVER['REMOTE_ADDR'] = '127.0.0.1';

if ( ! defined( 'COOKIEHASH' ) ) {
	define( 'COOKIEHASH', md5( uniqid() ) );
}

function _manually_load_plugin() {
	require dirname( __FILE__ ) . '/../exchange-addon-licensing.php';
	require dirname( __FILE__ ) . '/../../ithemes-exchange/init.php';
	require dirname( __FILE__ ) . '/../../exchange-addon-recurring-payments/exchange-addon-recurring-payments.php';
	require dirname( __FILE__ ) . '/../../exchange-addon-manual-purchases/exchange-addon-manual-purchases.php';

	// exchange pulls from a saved option to determine the current version
	// which isn't yet saved when running unit tests
	require dirname( __FILE__ ) . '/../../exchange-addon-manual-purchases/init.php';
}

tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

require $_tests_dir . '/includes/bootstrap.php';

require dirname( __FILE__ ) . '/framework/product-factory.php';
require dirname( __FILE__ ) . '/framework/key-factory.php';
require dirname( __FILE__ ) . '/framework/test-case.php';

activate_plugin( 'exchange-addon-licensing/exchange-addon-licensing.php' );
activate_plugin( 'exchange-addon-manual-purchases/exchange-addon-manual-purchases.php' );
activate_plugin( 'exchange-addon-recurring-payments/exchange-addon-recurring-payments.php' );
activate_plugin( 'ithemes-exchange/init.php' );<commit_msg>Only load Exchange during tests, if it hasn't been loaded already<commit_after><?php
/**
 * Bootstrap Unit Tests
 *
 * @author <NAME>
 * @since  1.0
 */

$_tests_dir = getenv( 'WP_TESTS_DIR' );

if ( ! $_tests_dir ) {
	$_tests_dir = '/tmp/wordpress-tests-lib';
}
require_once $_tests_dir . '/includes/functions.php';

$_SERVER['REMOTE_ADDR'] = '127.0.0.1';

if ( ! defined( 'COOKIEHASH' ) ) {
	define( 'COOKIEHASH', md5( uniqid() ) );
}

function _manually_load_plugin() {
	require_once dirname( __FILE__ ) . '/../exchange-addon-licensing.php';

	if ( ! function_exists( 'load_it_exchange' ) ) {
		require_once dirname( __FILE__ ) . '/../../ithemes-exchange/init.php';
	}

	require_once dirname( __FILE__ ) . '/../../exchange-addon-recurring-payments/exchange-addon-recurring-payments.php';
	require_once dirname( __FILE__ ) . '/../../exchange-addon-manual-purchases/exchange-addon-manual-purchases.php';

	// exchange pulls from a saved option to determine the current version
	// which isn't yet saved when running unit tests
	require_once dirname( __FILE__ ) . '/../../exchange-addon-manual-purchases/init.php';
}

tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

require $_tests_dir . '/includes/bootstrap.php';

require dirname( __FILE__ ) . '/framework/product-factory.php';
require dirname( __FILE__ ) . '/framework/key-factory.php';
require dirname( __FILE__ ) . '/framework/test-case.php';

if ( ! function_exists( 'load_it_exchange' ) ) {
	activate_plugin( 'ithemes-exchange/init.php' );
}

activate_plugin( 'exchange-addon-licensing/exchange-addon-licensing.php' );
activate_plugin( 'exchange-addon-manual-purchases/exchange-addon-manual-purchases.php' );
activate_plugin( 'exchange-addon-recurring-payments/exchange-addon-recurring-payments.php' );
{'fraction_non_alphanumeric': 0.1656769596199525, 'fraction_numerical': 0.005344418052256532, 'mean_word_length': 4.399038461538462, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3785016', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1170, 'n_words': 204}