本文整理汇总了PHP中tests_add_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP tests_add_filter函数的具体用法?PHP tests_add_filter怎么用?PHP tests_add_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tests_add_filter函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: exit
if (!getenv('WP_TESTS_DIR')) {
exit('$_ENV["WP_TESTS_DIR"] is not set.' . PHP_EOL);
}
include __DIR__ . '/../../../vendor/autoload.php';
/**
* The WordPress tests functions.
*
* Clearly, WP_TESTS_DIR should be the path to the WordPress PHPUnit tests checkout.
*
* We are loading this so that we can add our tests filter to load the plugin, using
* tests_add_filter().
*
* @since 1.0.0
*/
require_once getenv('WP_TESTS_DIR') . '/includes/functions.php';
tests_add_filter('muplugins_loaded', function () {
$plugin_file = dirname(dirname(dirname(__DIR__))) . '/plugin.php';
include $plugin_file;
do_action('activate_' . plugin_basename($plugin_file));
});
/**
* Sets up the WordPress test environment.
*
* We've got our action set up, so we can load this now, and viola, the tests begin.
* Again, WordPress' PHPUnit test suite needs to be installed under the given path.
*
* @since 1.0.0
*/
require getenv('WP_TESTS_DIR') . '/includes/bootstrap.php';
include __DIR__ . '/export-testcase.php';
include __DIR__ . '/testcases/import.php';
开发者ID:lkwdwrd,项目名称:phpdoc-parser,代码行数:31,代码来源:bootstrap.php
示例17: getenv
<?php
$wp_tests_dir = getenv('WP_TESTS_DIR');
require_once $wp_tests_dir . '/includes/functions.php';
function _manually_load_environment()
{
$plugins_to_active = array(basename(dirname(__DIR__)) . "/plugin.php");
// allow explicitly setting the plugin slug
if (getenv('WP_PLUGIN_SLUG')) {
$plugins_to_active = array(getenv('WP_PLUGIN_SLUG') . "/plugin.php");
}
update_option('active_plugins', $plugins_to_active);
$pmp_creds = array('pmp_api_url' => getenv('PMP_API_URL'), 'pmp_client_id' => getenv('PMP_CLIENT_ID'), 'pmp_client_secret' => getenv('PMP_CLIENT_SECRET'));
update_option('pmp_settings', $pmp_creds);
$GLOBALS['pmp_stash'] = array();
}
tests_add_filter('muplugins_loaded', '_manually_load_environment');
require $wp_tests_dir . '/includes/bootstrap.php';
开发者ID:jackbrighton,项目名称:pmp-wordpress,代码行数:18,代码来源:bootstrap.php
示例18: getenv
<?php
$_tests_dir = getenv('WP_TESTS_DIR');
if (!$_tests_dir) {
$_tests_dir = '/tmp/wordpress-tests-lib';
}
require_once $_tests_dir . '/includes/functions.php';
/**
* Load the REST API and our own plugin.
*/
function _manually_load_oembed_api_plugin()
{
require dirname(__FILE__) . '/../wp-api-oembed.php';
}
tests_add_filter('muplugins_loaded', '_manually_load_oembed_api_plugin');
require $_tests_dir . '/includes/bootstrap.php';
开发者ID:noplanman,项目名称:oEmbed-API,代码行数:16,代码来源:bootstrap.php
示例19: unset
$GLOBALS['base'] = '/';
} else {
echo "Running as single site... To run multisite, use -c tests/phpunit/multisite.xml" . PHP_EOL;
}
unset($multisite);
require_once dirname(__FILE__) . '/functions.php';
// Preset WordPress options defined in bootstrap file.
// Used to activate themes, plugins, as well as other settings.
if (isset($GLOBALS['wp_tests_options'])) {
function wp_tests_options($value)
{
$key = substr(current_filter(), strlen('pre_option_'));
return $GLOBALS['wp_tests_options'][$key];
}
foreach (array_keys($GLOBALS['wp_tests_options']) as $key) {
tests_add_filter('pre_option_' . $key, 'wp_tests_options');
}
}
// Load WordPress
require_once ABSPATH . '/wp-settings.php';
// Delete any default posts & related data
_delete_all_posts();
add_filter('user_has_cap', "ut_user_has_cap", 9, 3);
function ut_user_has_cap($all_caps, $cap, $args)
{
$all_caps["gform_full_access"] = true;
return $all_caps;
}
if (!class_exists('RGForms')) {
require GRAVITYFORMS_BASE_PATH . 'gravityforms.php';
}
开发者ID:jakejackson1,项目名称:gravityflow,代码行数:31,代码来源:bootstrap.php
示例20: define
<?php
/**
* Tests bootstrapper
*
* @author X-Team <x-team.com>
* @author Jonathan Bardo <[email protected]>
*/
// Use in code to trigger custom actions
define('STREAM_TESTS', true);
define('WP_STREAM_DEV_DEBUG', true);
$_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', function () {
// Manually load plugin
require dirname(dirname(__FILE__)) . '/stream.php';
});
require getenv('WP_TESTS_DIR') . 'includes/bootstrap.php';
require dirname(__FILE__) . '/testcase.php';
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:22,代码来源:bootstrap.php
注:本文中的tests_add_filter函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论