0); } function wp_installing( $is_installing = null ) { return false; } function wp_doing_ajax() { return false; } require ABSPATH . WPINC . '/plugin.php'; require ABSPATH . WPINC . '/compat.php'; require ABSPATH . WPINC . '/class-wp-error.php'; require ABSPATH . WPINC . '/functions.php'; require ABSPATH . WPINC . '/compat-utf8.php'; require ABSPATH . WPINC . '/utf8.php'; require ABSPATH . WPINC . '/formatting.php'; add_filter('pre_option', function($pre, $option) { $options = array( 'upload_path' => getenv('CASCO_TEST_ROOT') . '/test-uploads', 'upload_url_path' => 'https://example.invalid/test-uploads', 'uploads_use_yearmonth_folders' => 0, 'siteurl' => 'https://example.invalid', 'home' => 'https://example.invalid', 'admin_email' => 'fixture@example.invalid', 'blog_charset' => 'UTF-8', 'timezone_string' => 'UTC', 'gmt_offset' => 0, ); return isset($options[$option]) ? $options[$option] : ''; }, 10, 2); $GLOBALS['fixture_meta'] = array(); function get_post($id) { return (object) array('ID' => 1, 'post_name' => 'fixture', 'post_title' => 'Fixture'); } function get_post_meta($id, $key, $single = false) { $values = array('_wplf_title_format' => 'Fixture submission', '_wplf_media_library' => false, '_wplf_email_copy_to' => 'fixture@example.invalid', '_wplf_thank_you' => 'Accepted'); return isset($values[$key]) ? $values[$key] : ''; } function wp_insert_post($post) { return 101; } function add_post_meta($id, $key, $value, $unique = false) { $GLOBALS['fixture_meta'][$key] = $value; return 1; } register_shutdown_function(function() { file_put_contents(getenv('CASCO_TEST_ROOT') . '/last-request-effects.json', json_encode(array('meta' => $GLOBALS['fixture_meta'], 'files' => array_map('basename', glob(getenv('CASCO_TEST_ROOT') . '/test-uploads/*') ?: array())))); }); if (isset($_GET['partial']) && isset($_FILES['attachment'])) { $_FILES['attachment']['error'] = UPLOAD_ERR_PARTIAL; } $target = getenv('CASCO_TEST_VARIANT') === 'baseline' ? $fixture_root . '/wplf-ajax.baseline.php' : $fixture_root . '/wp-libre-form/inc/wplf-ajax.php'; require $target; wplf_ajax_submit_handler();