From 3607d99181ca17ebfb4ce2ad5b2864b193a58464 Mon Sep 17 00:00:00 2001 From: Jacson Passold Date: Mon, 4 Dec 2017 16:42:41 -0200 Subject: [PATCH] add a base class for api test cases --- tests/bootstrap.php | 1 + tests/tainacan-unit-api-test-case.php | 37 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/tainacan-unit-api-test-case.php diff --git a/tests/bootstrap.php b/tests/bootstrap.php index ea7dd4c59..12d467ecc 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -32,4 +32,5 @@ require_once(__DIR__ . '/factories/class-tainacan-entity-factory.php'); require_once(__DIR__ . '/factories/class-tainacan-field-factory.php'); require_once(__DIR__ . '/factories/class-tainacan-filter-factory.php'); require_once(__DIR__ . '/tainacan-unit-test-case.php'); +require_once(__DIR__ . '/tainacan-unit-api-test-case.php'); diff --git a/tests/tainacan-unit-api-test-case.php b/tests/tainacan-unit-api-test-case.php new file mode 100644 index 000000000..977619ac4 --- /dev/null +++ b/tests/tainacan-unit-api-test-case.php @@ -0,0 +1,37 @@ +server = $wp_rest_server = new \WP_REST_Server; + do_action( 'rest_api_init' ); + + //add_action( 'init', array($this, 'activate_plugin_via_php' ) ); + } + public function activate_plugin_via_php() { + $active_plugins = get_option( 'active_plugins' ); + array_push($active_plugins, 'tainacan/tainacan.php'); /* Here just replace unyson plugin directory and plugin file*/ + update_option( 'active_plugins', $active_plugins ); + } +} \ No newline at end of file