| 1 |
<?php |
| 2 |
// Basic stubs for WordPress functions used in tests |
| 3 |
|
| 4 |
if ( ! function_exists( 'delete_transient' ) ) { |
| 5 |
$GLOBALS['deleted_transients'] = []; |
| 6 |
function delete_transient( $name ) { |
| 7 |
$GLOBALS['deleted_transients'][] = $name; |
| 8 |
return true; |
| 9 |
} |
| 10 |
} |
| 11 |
|
| 12 |
if ( ! function_exists( 'delete_option' ) ) { |
| 13 |
$GLOBALS['deleted_options'] = []; |
| 14 |
function delete_option( $name ) { |
| 15 |
$GLOBALS['deleted_options'][] = $name; |
| 16 |
return true; |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
if ( ! function_exists( 'sanitize_text_field' ) ) { |
| 21 |
function sanitize_text_field( $text ) { |
| 22 |
return trim( strip_tags( $text ) ); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
if ( ! function_exists( 'wp_unslash' ) ) { |
| 27 |
function wp_unslash( $text ) { |
| 28 |
return stripslashes( $text ); |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
if ( ! function_exists( 'add_action' ) ) { |
| 33 |
$GLOBALS['actions_called'] = []; |
| 34 |
function add_action( $hook, $callback, $priority = 10, $accepted_args = 1 ) { |
| 35 |
$GLOBALS['actions_called'][] = func_get_args(); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
if ( ! function_exists( 'add_filter' ) ) { |
| 40 |
$GLOBALS['filters_called'] = []; |
| 41 |
function add_filter( $hook, $callback, $priority = 10, $accepted_args = 1 ) { |
| 42 |
$GLOBALS['filters_called'][] = func_get_args(); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
require __DIR__ . '/../includes/class-mlsimport-loader.php'; |
| 47 |
require __DIR__ . '/../includes/class-mlsimport-activator.php'; |
| 48 |
require __DIR__ . '/../includes/class-mlsimport-deactivator.php'; |
| 49 |
require __DIR__ . '/../includes/help_functions.php'; |
| 50 |
|