当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Mock::setUp方法代码示例

本文整理汇总了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));
 }
开发者ID:acobster,项目名称:wp-custom-field-traits,代码行数:7,代码来源:Base.php

示例2: setUp

 public function setUp()
 {
     \WP_Mock::setUp();
     \WP_Mock::wpFunction('stripslashes_deep', ['return' => function ($array) {
         return $array;
     }]);
 }
开发者ID:dxw,项目名称:iguana,代码行数:7,代码来源:registrar_test.php

示例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();
 }
开发者ID:vccabral,项目名称:cms-toolkit,代码行数:29,代码来源:test-cli-migrate.php

示例4: setUp

 function setUp()
 {
     global $post;
     $post = new \StdClass();
     $post->ID = 1;
     $post->post_type = 'post';
     \WP_Mock::setUp();
 }
开发者ID:vccabral,项目名称:cms-toolkit,代码行数:8,代码来源:test-meta_box_models.php

示例5: setUp

 public function setUp()
 {
     \WP_Mock::setUp();
     /*\WP_Mock::wpFunction('wp_upload_dir', [
               'return' => ['baseurl' => 'http://www.example.com']
           ]
       );*/
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-test,代码行数:8,代码来源:HelpersTest.php

示例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();
     }
 }
开发者ID:versionpress,项目名称:versionpress,代码行数:9,代码来源:HookMock.php

示例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();
     }
 }
开发者ID:diegolameira,项目名称:w.eloquent,代码行数:15,代码来源:TestCase.php

示例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;
     }]);
 }
开发者ID:dxw,项目名称:iguana,代码行数:11,代码来源:cookie_test.php

示例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;
 }
开发者ID:kraftbj,项目名称:lets-encrypt-wp,代码行数:12,代码来源:NonceTest.php

示例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;
 }
开发者ID:kraftbj,项目名称:lets-encrypt-wp,代码行数:13,代码来源:ResourcesTest.php

示例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();
 }
开发者ID:kraftbj,项目名称:lets-encrypt-wp,代码行数:15,代码来源:DirectoryTest.php

示例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();
 }
开发者ID:pemiu01,项目名称:exchange-addon-licensing,代码行数:20,代码来源:test-case.php

示例13: setUp

 public function setUp()
 {
     \WP_Mock::setUp();
     require_once dirname(__FILE__) . '/../admin/disable-emojis.php';
 }
开发者ID:mikeselander,项目名称:travel-blog,代码行数:5,代码来源:test-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();
 }
开发者ID:nocttuam,项目名称:lyric,代码行数:6,代码来源:submenu-builder-Test.php

示例15: setUp

 function setUp()
 {
     global $wp_locale;
     $wp_locale = $this->getMockBuilder('\\WP_Locale')->setMethods(array('get_month'))->getMock();
     \WP_Mock::setUp();
 }
开发者ID:vccabral,项目名称:cms-toolkit,代码行数:6,代码来源:test-meta_box_html.php


注:本文中的WP_Mock::setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。