Esempio n. 1
0
 /**
  * Install Give after the test environment and Give have been loaded.
  *
  * @since 1.3.2
  */
 public function install_give()
 {
     // clean existing install first
     define('WP_UNINSTALL_PLUGIN', true);
     include $this->plugin_dir . '/uninstall.php';
     echo "Installing Give..." . PHP_EOL;
     give_install();
     // reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374
     $GLOBALS['wp_roles']->reinit();
 }
Esempio n. 2
0
 /**
  * Install Give after the test environment and Give have been loaded.
  *
  * @since 1.3.2
  */
 public function install_give()
 {
     // clean existing install first
     define('WP_UNINSTALL_PLUGIN', true);
     include $this->plugin_dir . '/uninstall.php';
     echo "Installing Give..." . PHP_EOL;
     give_install();
     // reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374
     $GLOBALS['wp_roles']->reinit();
     $current_user = new WP_User(1);
     $current_user->set_role('administrator');
     wp_update_user(array('ID' => 1, 'first_name' => 'Admin', 'last_name' => 'User'));
     add_filter('give_log_email_errors', '__return_false');
 }
Esempio n. 3
0
<?php

$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
$_SERVER['SERVER_NAME'] = '';
$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
define('GIVE_USE_PHP_SESSIONS', false);
$_tests_dir = getenv('WP_TESTS_DIR');
if (!$_tests_dir) {
    $_tests_dir = '/tmp/wordpress-tests-lib';
}
require_once $_tests_dir . '/includes/functions.php';
function _manually_load_plugin()
{
    require dirname(__FILE__) . '/../give.php';
}
tests_add_filter('muplugins_loaded', '_manually_load_plugin');
require $_tests_dir . '/includes/bootstrap.php';
activate_plugin('give/give.php');
echo "Installing Give...\n";
// Install Give
give_install();
global $current_user, $give_options;
$give_options = get_option('give_settings');
$current_user = new WP_User(1);
$current_user->set_role('administrator');
// Include helpers
require_once 'helpers/shims.php';
require_once 'helpers/class-helper-form.php';
require_once 'helpers/class-helper-payment.php';
Esempio n. 4
0
 /**
  * Test that the install doesn't redirect when activating multiple plugins.
  *
  * @since 1.3.2
  */
 public function test_install_bail()
 {
     $_GET['activate-multi'] = 1;
     give_install();
     $this->assertFalse(get_transient('activate-multi'));
 }
Esempio n. 5
0
/**
 * Network Activated New Site Setup
 *
 * @description: When a new site is created when Give is network activated this function runs the appropriate install function to set up the site for Give.
 *
 * @since      1.3.5
 *
 * @param $blog_id
 * @param $user_id
 * @param $domain
 * @param $path
 * @param $site_id
 * @param $meta
 */
function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta)
{
    if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
        switch_to_blog($blog_id);
        give_install();
        restore_current_blog();
    }
}