tainacan/tests/bootstrap.php

41 lines
1.3 KiB
PHP
Raw Permalink Normal View History

<?php
/**
* PHPUnit bootstrap file
*
* @package Test_Tainacan
*/
$bootstrap_cfg = require('bootstrap-config.php');
$_tests_dir = getenv( 'WP_TESTS_DIR' );
if ( ! $_tests_dir ) {
$_tests_dir = $bootstrap_cfg['tests_dir'];
}
2017-11-29 19:11:30 +00:00
if (isset($bootstrap_cfg['tests_url'])) {
define( 'TAINACAN_TESTS_URL', $bootstrap_cfg['tests_url'] );
}
2017-11-29 19:11:30 +00:00
// Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php';
/**
* Manually load the plugin being tested.
*/
function _manually_load_plugin() {
2017-11-22 11:36:24 +00:00
require dirname( dirname( __FILE__ ) ) . '/src/tainacan.php';
add_action('plugins_loaded', function() {
do_action('activate_' . substr(dirname( dirname( __FILE__ ) ), 1) . '/src/tainacan.php');
});
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
// Start up the WP testing environment.
require_once dirname( dirname( __FILE__ ) ) . '/src/vendor/autoload.php';
require $_tests_dir . '/includes/bootstrap.php';
require_once(__DIR__ . '/factories/class-tainacan-entity-factory.php');
require_once( __DIR__ . '/factories/class-tainacan-metadatum-factory.php' );
require_once(__DIR__ . '/factories/class-tainacan-filter-factory.php');
require_once(__DIR__ . '/factories/class-tainacan-item-metadata-factory.php');
require_once(__DIR__ . '/tainacan-unit-test-case.php');
2017-12-04 18:42:41 +00:00
require_once(__DIR__ . '/tainacan-unit-api-test-case.php');