本文整理汇总了PHP中WP_Mock::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Mock::setUp方法的具体用法?PHP WP_Mock::setUp怎么用?PHP WP_Mock::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Mock
的用法示例。
在下文中一共展示了WP_Mock::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
WP::setUp();
$this->plugin = \Cft\Plugin::getInstance();
$this->plugin->set('validatorBuilder', new \Cft\ValidatorBuilder($this->plugin));
$this->plugin->set('fieldBuilder', new \Cft\FieldBuilder($this->plugin));
}
示例2: setUp
public function setUp()
{
\WP_Mock::setUp();
\WP_Mock::wpFunction('stripslashes_deep', ['return' => function ($array) {
return $array;
}]);
}
示例3: setUp
function setUp()
{
$this->getMock('\\WP_CLI_Command');
$this->getMock('\\CFPB\\CLI_Common');
$this->cli = $this->getMockBuilder('\\WP_CLI')->setMethods(array('success'))->getMock();
require_once 'cli/migrate.php';
$this->validTaxonomyArgs = array('category', 'new_category');
$this->missingTaxonomyArg = array('category');
$this->authorWithArg = array('category');
$this->include = array('include' => 1);
$this->exclude = array('exclude' => 1);
$this->post_type = array('post_type' => 'custom_post_type');
$this->before = array('before' => '2013-05-01');
$this->after = array('after' => '2013-01-01');
$this->ignore_term = array('ignore_term' => 'custom_taxonomy,term,term-2');
$this->post0 = new stdClass();
$this->post1 = new stdClass();
$this->term0 = new stdClass();
$this->term1 = new stdClass();
$this->post0->ID = 1;
$this->post1->ID = 2;
$this->term0->name = "Term";
$this->term0->slug = "term";
$this->term1->name = "Another";
$this->term1->slug = "another";
$this->terms = array($this->term0, $this->term1);
$this->posts = array('posts' => array($this->post0, $this->post1), 'message' => 'Posts to migrate');
\WP_Mock::setUp();
}
示例4: setUp
function setUp()
{
global $post;
$post = new \StdClass();
$post->ID = 1;
$post->post_type = 'post';
\WP_Mock::setUp();
}
示例5: setUp
public function setUp()
{
\WP_Mock::setUp();
/*\WP_Mock::wpFunction('wp_upload_dir', [
'return' => ['baseurl' => 'http://www.example.com']
]
);*/
}
示例6: setUp
public static function setUp($type = HookMock::TRUE_HOOKS)
{
require_once __DIR__ . '/hookmock-functions.php';
self::$type = $type;
self::$hooks = [];
if (self::$type === HookMock::WP_MOCK) {
\WP_Mock::setUp();
}
}
示例7: setUp
/**
* Setup the test environment.
*
* @return void
*/
public function setUp()
{
\WP_Mock::setUp();
if (!$this->app) {
$this->app = $this->createApplication();
$this->client = $this->createClient();
$this->app->setRequestForConsoleEnvironment();
$this->app->boot();
}
}
示例8: setUp
public function setUp()
{
\WP_Mock::setUp();
\WP_Mock::wpFunction('stripslashes_deep', ['return' => function ($array) {
$newArray = [];
foreach ($array as $k => $v) {
$newArray[$k] = stripslashes($v);
}
return $newArray;
}]);
}
示例9: make_request
private function make_request()
{
$url = 'http://acme.org/new-authz';
$response = MockData::get_head_response();
\WP_Mock::setUp();
// Mock the remote request
\WP_Mock::wpFunction('wp_remote_request', array('args' => array($url, array('body' => '')), 'times' => 1, 'return' => $response));
$nonce = new \LEWP\Request\Nonce($url);
$nonce->send();
\WP_Mock::tearDown();
return $nonce;
}
示例10: get_directory_object
private function get_directory_object()
{
$url = 'http://acme.org/directory';
$args = array('body' => '');
$response = MockData::get_directory_response();
\WP_Mock::setUp();
// Mock the remote request
\WP_Mock::wpFunction('wp_remote_request', array('args' => array($url, $args), 'times' => 1, 'return' => $response));
$directory = new \LEWP\Request\Directory($url);
$directory->send();
\WP_Mock::tearDown();
return $directory;
}
示例11: test_send_generates_response_and_sets_properties
public function test_send_generates_response_and_sets_properties()
{
$url = 'http://acme.org/directory';
$args = array('body' => '');
$response = MockData::get_directory_response();
\WP_Mock::setUp();
// Mock the remote request
\WP_Mock::wpFunction('wp_remote_request', array('args' => array($url, $args), 'times' => 1, 'return' => $response));
$directory = new \LEWP\Request\Directory($url);
$this->assertEquals($response, $directory->send());
$this->assertEquals($response, $directory->get_response());
$this->assertEquals($response['body'], $directory->get_body());
$this->assertEquals($response['headers']['replay-nonce'], $directory->get_response_nonce());
\WP_Mock::tearDown();
}
示例12: setUp
/**
* Do custom initialization.
*/
public function setUp()
{
parent::setUp();
it_exchange_temporarily_load_addon('guest-checkout');
it_exchange_temporarily_load_addon('digital-downloads-product-type');
it_exchange_add_feature_support_to_product_type('recurring-payments', 'digital-downloads-product-type');
$null = null;
$this->exchange_admin = new IT_Exchange_Admin($null);
it_exchange_save_option('settings_general', $this->exchange_admin->set_general_settings_defaults(array()));
it_exchange_get_option('settings_general', true);
$this->product_factory = new ITELIC_UnitTest_Factory_For_Products();
$this->key_factory = new ITELIC_UnitTest_Factory_For_Keys($this->factory);
$this->activation_factory = new ITELIC_UnitTest_Factory_For_Activations($this->factory);
$this->release_factory = new ITELIC_UnitTest_Factory_For_Releases($this->factory);
$this->update_factory = new ITELIC_UnitTest_Factory_For_Updates($this->factory);
WP_Mock::setUp();
}
示例13: setUp
public function setUp()
{
\WP_Mock::setUp();
require_once dirname(__FILE__) . '/../admin/disable-emojis.php';
}
示例14: setUp
protected function setUp()
{
$menu = new Menu_Builder('Lyric Menu', 23);
$this->submenu = new Submenu_Builder('Lyric Submenu', $menu);
\WP_Mock::setUp();
}
示例15: setUp
function setUp()
{
global $wp_locale;
$wp_locale = $this->getMockBuilder('\\WP_Locale')->setMethods(array('get_month'))->getMock();
\WP_Mock::setUp();
}