-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathphpunit-bootstrap.php
More file actions
27 lines (20 loc) · 862 Bytes
/
phpunit-bootstrap.php
File metadata and controls
27 lines (20 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
use SIL\Tests\Mocks\MockWP_Http;
const PHP_UNIT = true;
const TESTS_DIR = __DIR__ . '/test-php';
const CONFIG_DIR = TESTS_DIR . '/config';
const TEST_RESOURCES = TESTS_DIR . '/resources';
const WEBONARY_CLOUD_DEFAULT_DICTIONARY_ID = 'unit_test';
const WEBONARY_CLOUD_API_URL = 'https://unit-test.local/v1/';
const WEBONARY_CLOUD_FILE_URL = 'https://unit-test.local/';
register_shutdown_function(function(){
print 'SHUTDOWN' . PHP_EOL;
});
include_once 'wordpress-develop/tests/phpunit/includes/bootstrap.php';
// we need to set this before activating the plugin
update_option('useCloudBackend', '1');
// activate the Webonary plugin
activate_plugin('sil-dictionary-webonary/sil-dictionary.php');
do_action('init');
// this is so we can mock requests to the cloud
add_filter('pre_http_request', [MockWP_Http::class, 'HandleHttpRequest'], 10, 3);