forked from 10up/wp_mock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constant-mocks.php
72 lines (62 loc) · 1.51 KB
/
constant-mocks.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
<?php
/**
* Certain constants need to be mocked otherwise various WordPress functions will attempt
* to include files that just don't exist.
*
* For example, nearly all uses of the WP_Http API require first including:
* ABSPATH . WPINC . '/class-http.php'
*
* If these constants are not set, and files do not exist at the location they specify,
* functions referencing them will fatally err.
*
* The `! defined` check is used here so that individual test environments can override
* the normal default by setting constants in a bootstrap configuration file.
*/
if ( ! defined( 'WP_CONTENT_DIR' ) ) {
define( 'WP_CONTENT_DIR', __DIR__ . '/dummy-files' );
}
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', '' );
}
if ( ! defined( 'WPINC' ) ) {
define( 'WPINC', __DIR__ . '/dummy-files/wp-includes' );
}
/**
* @since 0.71
*/
if ( ! defined( 'EZSQL_VERSION' ) ) {
define( 'EZSQL_VERSION', 'WP1.25' );
}
/**
* HHVM does not support case-insensitive constants.
*
* @since 0.71
* @see http://hhvm.com/blog/3095/getting-wordpress-running-on-hhvm
*/
if ( ! defined( 'OBJECT' ) ) {
define( 'OBJECT', 'OBJECT' );
}
if ( ! defined( 'Object' ) ) {
define( 'Object', 'OBJECT' );
}
if ( ! defined( 'object' ) ) {
define( 'object', 'OBJECT' );
}
/**
* @since 2.5.0
*/
if ( ! defined( 'OBJECT_K' ) ) {
define( 'OBJECT_K', 'OBJECT_K' );
}
/**
* @since 0.71
*/
if ( ! defined( 'ARRAY_A' ) ) {
define( 'ARRAY_A', 'ARRAY_A' );
}
/**
* @since 0.71
*/
if ( ! defined( 'ARRAY_N' ) ) {
define( 'ARRAY_N', 'ARRAY_N' );
}