2018-04-27 11:19:02 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$_tests_dir = getenv('WP_TESTS_DIR');
|
2020-07-10 13:14:03 +03:00
|
|
|
$_output_logs_to_stdout = getenv('MODULE_LOGS_TO_STDOUT');
|
2020-05-27 11:51:56 +03:00
|
|
|
$_wcOldBootstrap = '/tmp/woocommerce/tests/bootstrap.php';
|
|
|
|
$_wcNewBootstrap = '/tmp/woocommerce/tests/legacy/bootstrap.php';
|
2018-04-27 11:19:02 +03:00
|
|
|
|
|
|
|
if (!$_tests_dir) {
|
|
|
|
$_tests_dir = '/tmp/wordpress-tests-lib';
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once $_tests_dir . '/includes/functions.php';
|
|
|
|
|
|
|
|
function _manually_load_plugin() {
|
2020-02-25 14:45:04 +03:00
|
|
|
$plugin_dir = dirname(dirname(__FILE__)) . '/';
|
2018-04-27 11:19:02 +03:00
|
|
|
|
2018-04-27 12:06:09 +03:00
|
|
|
require $plugin_dir . 'src/include/class-wc-retailcrm-orders.php';
|
|
|
|
require $plugin_dir . 'src/include/class-wc-retailcrm-customers.php';
|
|
|
|
require $plugin_dir . 'src/include/class-wc-retailcrm-inventories.php';
|
2018-05-28 12:56:19 +03:00
|
|
|
require $plugin_dir . 'src/include/class-wc-retailcrm-ga.php';
|
2019-01-16 15:33:26 +03:00
|
|
|
require $plugin_dir . 'src/include/class-wc-retailcrm-daemon-collector.php';
|
2018-07-19 12:16:30 +03:00
|
|
|
require $plugin_dir . 'src/include/class-wc-retailcrm-history.php';
|
2020-04-05 10:36:45 +03:00
|
|
|
require $plugin_dir . 'src/include/class-wc-retailcrm-icml.php';
|
2018-04-27 12:06:09 +03:00
|
|
|
require $plugin_dir . 'src/retailcrm.php';
|
2018-04-27 11:19:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
tests_add_filter('muplugins_loaded', '_manually_load_plugin');
|
|
|
|
|
2020-05-27 11:51:56 +03:00
|
|
|
if (file_exists($_wcOldBootstrap)) {
|
|
|
|
require $_wcOldBootstrap;
|
|
|
|
} elseif (file_exists($_wcNewBootstrap)) {
|
|
|
|
require $_wcNewBootstrap;
|
|
|
|
}
|
2018-04-27 11:19:02 +03:00
|
|
|
|
2020-02-25 14:49:47 +03:00
|
|
|
$plugin_dir = dirname(dirname(__FILE__)) . '/';
|
2020-07-10 13:14:03 +03:00
|
|
|
|
2018-04-27 11:19:02 +03:00
|
|
|
// helpers
|
2020-07-10 13:14:03 +03:00
|
|
|
require $plugin_dir . 'src/include/components/class-wc-retailcrm-logger.php';
|
2018-04-27 12:06:09 +03:00
|
|
|
require $plugin_dir . 'tests/helpers/class-wc-retailcrm-response-helper.php';
|
|
|
|
require $plugin_dir . 'tests/helpers/class-wc-retailcrm-test-case-helper.php';
|
2020-07-10 13:14:03 +03:00
|
|
|
require $plugin_dir . 'tests/helpers/class-wc-retailcrm-log-handler-stdout.php';
|
|
|
|
|
|
|
|
if (!empty($_output_logs_to_stdout) && $_output_logs_to_stdout == '1') {
|
|
|
|
WC_Retailcrm_Logger::setAdditionalHandlers(array(new WC_Retailcrm_Log_Handler_Stdout()));
|
|
|
|
}
|