當前位置: 首頁>>代碼示例>>PHP>>正文


PHP tests_add_filter函數代碼示例

本文整理匯總了PHP中tests_add_filter函數的典型用法代碼示例。如果您正苦於以下問題:PHP tests_add_filter函數的具體用法?PHP tests_add_filter怎麽用?PHP tests_add_filter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了tests_add_filter函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_display

 public function test_display()
 {
     tests_add_filter('gtm/id', function () {
         return 'GTM-456';
     });
     simple_gtm();
     $this->expectOutputRegex('/id\\=GTM\\-456/');
 }
開發者ID:frozzare,項目名稱:simple-gtm,代碼行數:8,代碼來源:class-simple-gtm-test.php

示例2: _load_wordpress_tests

function _load_wordpress_tests($tests_directory)
{
    $GLOBALS['wp_tests_options'] = array('active_plugins' => array('wprestcop/wprestcop.php'), 'timezone_string' => 'America/Los_Angeles');
    require_once $tests_directory . '/includes/functions.php';
    tests_add_filter('muplugins_loaded', function () {
        require dirname(dirname(__DIR__)) . '/wprestcop.php';
    });
    require $tests_directory . '/includes/bootstrap.php';
}
開發者ID:cedaro,項目名稱:wprestcop,代碼行數:9,代碼來源:bootstrap.php

示例3: __construct

 public function __construct()
 {
     ini_set('display_errors', 'on');
     error_reporting(E_ALL);
     $this->wp_tests_dir = '/tmp/wordpress-tests-lib';
     $this->includes();
     require_once $this->wp_tests_dir . '/includes/functions.php';
     tests_add_filter('muplugins_loaded', array($this, 'load'));
     require_once $this->wp_tests_dir . '/includes/bootstrap.php';
 }
開發者ID:kilbot,項目名稱:WooCommerce-Software-License-Manager,代碼行數:10,代碼來源:bootstrap.php

示例4: __construct

 public function __construct()
 {
     ini_set('display_errors', 'on');
     error_reporting(E_ALL);
     $this->wp_tests_dir = '/tmp/wordpress-tests-lib';
     require_once $this->wp_tests_dir . '/includes/functions.php';
     tests_add_filter('muplugins_loaded', array($this, 'load_wc_pos'));
     tests_add_filter('setup_theme', array($this, 'install_wc_pos'));
     require_once $this->wp_tests_dir . '/includes/bootstrap.php';
     activate_plugin(WP_CONTENT_DIR . '/plugins/woocommerce/woocommerce.php');
 }
開發者ID:bostondv,項目名稱:WooCommerce-POS,代碼行數:11,代碼來源:bootstrap.php

示例5: _bp_follow_bootstrap

/**
 * Load BuddyPress and BP Follow.
 */
function _bp_follow_bootstrap()
{
    // Load up BP's specialized unit test loader
    require BP_TESTS_DIR . '/includes/loader.php';
    // make BP pass the bp_is_network_activated() check
    // this is needed when the BP directory is symlinked
    if (is_multisite()) {
        tests_add_filter('bp_is_network_activated', '__return_true');
    }
    _bp_follow_install();
    // Now load BP Follow
    require dirname(__FILE__) . '/../../../loader.php';
}
開發者ID:wesavetheworld,項目名稱:buddypress-followers,代碼行數:16,代碼來源:bootstrap.php

示例6: __construct

 public function __construct($testDir, $wpTestDir)
 {
     $this->testsDir = $testDir;
     $this->pluginDir = \dirname($this->testsDir);
     $this->wpTestsDir = $wpTestDir;
     // Give access to tests_add_filter() function.
     require_once $this->wpTestsDir . '/includes/functions.php';
     // Load WooCommerce
     \tests_add_filter('muplugins_loaded', array($this, 'loadWooCommerce'));
     // Load the plugin
     \tests_add_filter('muplugins_loaded', array($this, 'loadPlugin'));
     // Start up the WP testing environment.
     include_once $this->wpTestsDir . '/includes/bootstrap.php';
 }
開發者ID:flagshipcompany,項目名稱:flagship-for-woocommerce,代碼行數:14,代碼來源:Bootstrap.php

示例7: setup

 /**
  * Setup tests.
  */
 private function setup()
 {
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     $_SERVER['SERVER_NAME'] = 'localhost';
     $_tests_dir = getenv('WP_TESTS_DIR');
     if (!$_tests_dir) {
         $_tests_dir = '/tmp/wordpress-tests-lib';
     }
     require_once $_tests_dir . '/includes/functions.php';
     tests_add_filter('muplugins_loaded', array($this, 'load_plugins'));
     tests_add_filter('setup_theme', array($this, 'install_plugins'));
     require $_tests_dir . '/includes/bootstrap.php';
     require dirname(__FILE__) . '/../lib/edr-crt-test.php';
 }
開發者ID:educatorplugin,項目名稱:educator-certificates,代碼行數:17,代碼來源:bootstrap.php

示例8: __construct

 /**
  * Setup the unit testing environment
  *
  * @since 1.3.2
  */
 public function __construct()
 {
     ini_set('display_errors', 'on');
     error_reporting(E_ALL);
     $this->tests_dir = dirname(__FILE__);
     $this->plugin_dir = dirname($this->tests_dir);
     $this->wp_tests_dir = getenv('WP_TESTS_DIR') ? getenv('WP_TESTS_DIR') : '/tmp/wordpress-tests-lib';
     // load test function so tests_add_filter() is available
     require_once $this->wp_tests_dir . '/includes/functions.php';
     // load CF_API
     tests_add_filter('muplugins_loaded', array($this, 'load_cf_api'));
     // load the WP testing environment
     require_once $this->wp_tests_dir . '/includes/bootstrap.php';
     // load CF_API testing framework
     $this->includes();
 }
開發者ID:Desertsnowman,項目名稱:cf-api,代碼行數:21,代碼來源:bootstrap.php

示例9: __construct

 /**
  * Setup the unit testing environment
  */
 private function __construct()
 {
     ini_set('display_errors', 'on');
     error_reporting(E_ALL);
     $this->tests_dir = dirname(__FILE__);
     $this->plugin_dir = dirname($this->tests_dir);
     $this->wp_tests_dir = getenv('WP_TESTS_DIR') ? getenv('WP_TESTS_DIR') : $this->plugin_dir . '/tmp/wordpress-tests-lib';
     // load test function so tests_add_filter() is available
     require_once $this->wp_tests_dir . '/includes/functions.php';
     // load plugin
     tests_add_filter('muplugins_loaded', array($this, 'load_plugin'));
     // load the WP testing environment
     require_once $this->wp_tests_dir . '/includes/bootstrap.php';
     // make sure query vars are prepared
     global $wp;
     if (!is_array($wp->query_vars)) {
         $wp->query_vars = array();
     }
 }
開發者ID:tyxla,項目名稱:wp-hydra,代碼行數:22,代碼來源:bootstrap.php

示例10: __construct

 /**
  * Setup the unit testing environment.
  *
  * @since 2.2
  */
 public function __construct()
 {
     ini_set('display_errors', 'on');
     error_reporting(E_ALL);
     // Ensure server variable is set for WP email functions.
     if (!isset($_SERVER['SERVER_NAME'])) {
         $_SERVER['SERVER_NAME'] = 'localhost';
     }
     $this->tests_dir = dirname(__FILE__);
     $this->plugin_dir = dirname($this->tests_dir);
     $this->wp_tests_dir = getenv('WP_TESTS_DIR') ? getenv('WP_TESTS_DIR') : '/tmp/wordpress-tests-lib';
     // load test function so tests_add_filter() is available
     require_once $this->wp_tests_dir . '/includes/functions.php';
     // load WC
     tests_add_filter('muplugins_loaded', array($this, 'load_wc'));
     // install WC
     tests_add_filter('setup_theme', array($this, 'install_wc'));
     // load the WP testing environment
     require_once $this->wp_tests_dir . '/includes/bootstrap.php';
     // load WC testing framework
     $this->includes();
 }
開發者ID:pelmered,項目名稱:woocommerce,代碼行數:27,代碼來源:bootstrap.php

示例11: __construct

 /**
  * Setup the unit testing environment
  *
  * @since 1.9
  */
 public function __construct()
 {
     ini_set('display_errors', 'on');
     error_reporting(E_ALL);
     $this->tests_dir = dirname(__FILE__);
     $this->plugin_dir = dirname($this->tests_dir);
     $this->wp_tests_dir = getenv('WP_TESTS_DIR') ? getenv('WP_TESTS_DIR') : $this->plugin_dir . '/tmp/wordpress-tests-lib';
     // load test function so tests_add_filter() is available
     require_once $this->wp_tests_dir . '/includes/functions.php';
     // load GV
     tests_add_filter('muplugins_loaded', array($this, 'load'));
     tests_add_filter('gravityview_log_error', array($this, 'test_print_log'), 10, 3);
     // Log debug if passed to `phpunit` like: `phpunit --debug --verbose`
     if (in_array('--debug', (array) $_SERVER['argv'], true) && in_array('--verbose', (array) $_SERVER['argv'], true)) {
         tests_add_filter('gravityview_log_debug', array($this, 'test_print_log'), 10, 3);
     }
     // load the WP testing environment
     require_once $this->wp_tests_dir . '/includes/bootstrap.php';
     require_once $this->tests_dir . '/GV_UnitTestCase.php';
     require_once $this->tests_dir . '/factory.php';
     // set up GravityView
     $this->install();
 }
開發者ID:hansstam,項目名稱:makerfaire,代碼行數:28,代碼來源:bootstrap.php

示例12: getenv

<?php

$wp_tests_dir = getenv('WP_TESTS_DIR');
require_once $wp_tests_dir . '/includes/functions.php';
$basename = basename(dirname(__DIR__));
$GLOBALS['wp_tests_options'] = array('stylesheet' => $basename, 'template' => $basename);
tests_add_filter('set_current_user', function ($arg) {
    $user = wp_get_current_user();
    $user->set_role('administrator');
    return $arg;
}, 1, 10);
tests_add_filter('filesystem_method', function ($arg) {
    return 'direct';
}, 1, 10);
require dirname(__FILE__) . '/mock/mock-options-framework.php';
require dirname(__FILE__) . '/mock/mock-admin-functions.php';
require $wp_tests_dir . '/includes/bootstrap.php';
開發者ID:NathanLawrence,項目名稱:Largo,代碼行數:17,代碼來源:bootstrap.php

示例13: setup_filters

 public function setup_filters()
 {
     // Allow tests to override wp_die
     tests_add_filter('wp_die_handler', '_wp_die_handler_filter');
     // Preset WordPress options defined in bootstrap file.
     // Used to activate themes, plugins, as well as  other settings.
     if (isset($GLOBALS['wp_tests_options'])) {
         foreach (array_keys($GLOBALS['wp_tests_options']) as $key) {
             tests_add_filter('pre_option_' . $key, array($this, 'wp_tests_options'));
         }
     }
 }
開發者ID:artofwp,項目名稱:wp-testing,代碼行數:12,代碼來源:WP_Bootstrap.php

示例14: die

if (!($wp_test_dir = getenv('WP_TESTS_DIR'))) {
    $wp_test_dir = '/tmp/wordpress-tests-lib';
    if (!file_exists($wp_test_dir . '/includes')) {
        die("Fatal Error: Could not find the WordPress tests directory.\n");
    }
}
/**
 * Loads WP utility functions like `tests_add_filter` and `_delete_all_posts`.
 */
require_once $wp_test_dir . '/includes/functions.php';
/**
 * Preset wp_options before loading the WordPress stack.
 *
 * Used to activate themes, plugins, as well as other settings in `wp_options`.
 *
 * @see wp_tests_options
 */
$GLOBALS['wp_tests_options'] = array('active_plugins' => array('hello.php'));
/**
 * Run custom functionality after mu-plugins are loaded.
 */
function _tests_load_badgeos()
{
    define('CMB_DIRECTORY_PATH', trailingslashit(dirname(dirname(dirname(dirname(__FILE__))))));
    require CMB_DIRECTORY_PATH . 'init.php';
}
tests_add_filter('muplugins_loaded', '_tests_load_badgeos');
/**
 * Bootstraps the WordPress stack.
 */
require $wp_test_dir . '/includes/bootstrap.php';
開發者ID:eugene-gromky-co,項目名稱:mindfulnesssummit,代碼行數:31,代碼來源:bootstrap.php

示例15: getenv

<?php

require_once getenv('WP_TESTS_DIR') . '/includes/functions.php';
tests_add_filter('muplugins_loaded', create_function('', "require dirname( __FILE__ ) . '/../frontend-uploader.php';"));
require getenv('WP_TESTS_DIR') . '/includes/bootstrap.php';
開發者ID:sangikumar,項目名稱:IP,代碼行數:5,代碼來源:bootstrap.php


注:本文中的tests_add_filter函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。