/
bootstrap.php
110 lines (92 loc) · 1.99 KB
/
bootstrap.php
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* Bootstrap file for Cyr-To-Lat phpunit tests.
*
* @package cyr-to-lat
*/
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @noinspection RealpathInStreamContextInspection */
use tad\FunctionMocker\FunctionMocker;
/**
* Plugin main file.
*/
define( 'PLUGIN_MAIN_FILE', realpath( __DIR__ . '/../../cyr-to-lat.php' ) );
/**
* Plugin path.
*/
define( 'PLUGIN_PATH', realpath( dirname( PLUGIN_MAIN_FILE ) ) );
/**
* Kilobytes in bytes.
*/
const KB_IN_BYTES = 1024;
require_once PLUGIN_PATH . '/vendor/autoload.php';
if ( ! defined( 'ABSPATH' ) ) {
/**
* WordPress ABSPATH.
*/
define( 'ABSPATH', PLUGIN_PATH . '/../../../' );
}
/**
* Plugin version.
*/
const CYR_TO_LAT_TEST_VERSION = '5.2.4';
/**
* Path to the plugin dir.
*/
const CYR_TO_LAT_TEST_PATH = PLUGIN_PATH;
/**
* Plugin dir url.
*/
const CYR_TO_LAT_TEST_URL = 'https://site.org/wp-content/plugins/cyr2lat';
/**
* Main plugin file.
*/
const CYR_TO_LAT_TEST_FILE = PLUGIN_MAIN_FILE;
/**
* Plugin prefix.
*/
const CYR_TO_LAT_TEST_PREFIX = 'cyr_to_lat';
/**
* Post conversion action.
*/
const CYR_TO_LAT_TEST_POST_CONVERSION_ACTION = 'post_conversion_action';
/**
* Term conversion action.
*/
const CYR_TO_LAT_TEST_TERM_CONVERSION_ACTION = 'term_conversion_action';
/**
* Minimum required php version.
*/
const CYR_TO_LAT_TEST_MINIMUM_PHP_REQUIRED_VERSION = '5.6';
/**
* Minimum required max_input_vars value.
*/
const CYR_TO_LAT_TEST_REQUIRED_MAX_INPUT_VARS = 1000;
FunctionMocker::init(
[
'blacklist' => [
realpath( PLUGIN_PATH ),
],
'whitelist' => [
realpath( PLUGIN_PATH . '/cyr-to-lat.php' ),
realpath( PLUGIN_PATH . '/src/php' ),
realpath( PLUGIN_PATH . '/tests/phpunit/stubs' ),
],
'redefinable-internals' => [
'class_exists',
'define',
'defined',
'constant',
'filter_input',
'function_exists',
'ini_get',
'mb_strtolower',
'phpversion',
'realpath',
'time',
'error_log',
'rename',
],
]
);
WP_Mock::bootstrap();