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


PHP WP_Mock::expectFilterAdded方法代碼示例

本文整理匯總了PHP中WP_Mock::expectFilterAdded方法的典型用法代碼示例。如果您正苦於以下問題:PHP WP_Mock::expectFilterAdded方法的具體用法?PHP WP_Mock::expectFilterAdded怎麽用?PHP WP_Mock::expectFilterAdded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WP_Mock的用法示例。


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

示例1: testRegister

 public function testRegister()
 {
     $layoutRegister = new \Dxw\Iguana\Theme\LayoutRegister($this->getHelpers());
     $this->assertInstanceOf(\Dxw\Iguana\Registerable::class, $layoutRegister);
     \WP_Mock::expectFilterAdded('template_include', [\Dxw\Iguana\Theme\Layout::class, 'apply'], 99);
     $layoutRegister->register();
 }
開發者ID:dxw,項目名稱:iguana-theme,代碼行數:7,代碼來源:layout_register_test.php

示例2: test_ready_priority

 /**
  * Tests hooking the template loader to the WordPress template loading filters
  * with a priority.
  *
  * @covers ::ready
  *
  * @dataProvider loader_provider
  */
 public function test_ready_priority(Loader $loader)
 {
     $priority = rand(11, 99);
     \WP_Mock::expectFilterAdded('template_include', array($loader, 'filter'), $priority);
     $loader->ready($priority);
     $this->assertHooksAdded();
 }
開發者ID:goblindegook,項目名稱:syllables,代碼行數:15,代碼來源:Loader_Test.php

示例3: testInit

 public function testInit()
 {
     $useAtom = new \Dxw\Iguana\Extras\UseAtom();
     \WP_Mock::expectFilterAdded('default_feed', [$useAtom, 'defaultFeed']);
     \WP_Mock::wpFunction('remove_action', ['args' => ['do_feed_rdf', 'do_feed_rdf', 10, 1], 'times' => 1]);
     \WP_Mock::wpFunction('remove_action', ['args' => ['do_feed_rss', 'do_feed_rss', 10, 1], 'times' => 1]);
     \WP_Mock::wpFunction('remove_action', ['args' => ['do_feed_rss2', 'do_feed_rss2', 10, 1], 'times' => 1]);
     $useAtom->init();
 }
開發者ID:dxw,項目名稱:iguana-extras,代碼行數:9,代碼來源:use_atom_test.php

示例4: test_initialize

 public function test_initialize()
 {
     $model = Mockery::mock('tfrommen\\ExternalContent\\Models\\Post');
     /** @var tfrommen\ExternalContent\Models\Post $model */
     $testee = new Testee($model);
     WP_Mock::expectFilterAdded('post_type_link', array($model, 'get_external_url'), 10, 2);
     WP_Mock::expectFilterAdded('pre_get_shortlink', array($model, 'get_shortlink'), 10, 3);
     $testee->initialize();
     $this->assertHooksAdded();
 }
開發者ID:tfrommen,項目名稱:external-content,代碼行數:10,代碼來源:PostControllerTest.php

示例5: test_init

 /**
  * Test that the actions are successfully added.
  */
 public function test_init()
 {
     $this->dt = new \notne\Da_Tag\Da_Tag(dirname(__FILE__) . '/../');
     \WP_Mock::expectActionAdded('admin_notices', array($this->dt, 'admin_notices'), 10, 1);
     \WP_Mock::expectActionAdded('admin_init', array($this->dt, 'admin_notices_ignore'));
     \WP_Mock::expectActionAdded('save_post', array($this->dt, 'save_highlighted_tag'), 10, 3);
     \WP_Mock::expectActionAdded('admin_enqueue_scripts', array($this->dt, 'enqueues'));
     \WP_Mock::expectFilterAdded('post_submitbox_misc_actions', array($this->dt, 'highlight_tag'));
     $this->dt->init();
 }
開發者ID:rwrobe,項目名稱:datag,代碼行數:13,代碼來源:Da_TagTest.php

示例6: test_construct

 /**
  * Test constructor
  *
  * @since 4.0.0
  */
 public function test_construct()
 {
     // Setup.
     $journal = new Journal();
     \WP_Mock::expectActionAdded('init', array($journal, 'create_journal_type'));
     \WP_Mock::expectActionAdded('save_post', array($journal, 'journal_save_morning_meta'), 10, 2);
     \WP_Mock::expectActionAdded('save_post', array($journal, 'journal_save_evening_meta'), 10, 2);
     \WP_Mock::expectFilterAdded('wp_insert_post_data', array($journal, 'filter_wp_insert_post_data'), 10, 2);
     // Act.
     $journal->__construct();
     // Verify.
     $this->assertConditionsMet();
 }
開發者ID:ChrisWiegman,項目名稱:chriswiegman-plugin,代碼行數:18,代碼來源:Journal_Tests.php

示例7: test_setup

 /**
  * Test load method.
  *
  * @since 3.2.0
  */
 public function test_setup()
 {
     // Setup.
     \Mockery::mock('WP_Widget');
     \WP_Mock::wpFunction('current_time', array('times' => 1, 'return_arg' => time()));
     \WP_Mock::expectActionAdded('dashboard_glance_items', 'CW\\Plugin\\Core\\action_dashboard_glance_items');
     \WP_Mock::expectActionAdded('plugins_loaded', 'CW\\Plugin\\Core\\action_plugins_loaded');
     \WP_Mock::expectActionAdded('widgets_init', 'CW\\Plugin\\Core\\action_widgets_init');
     \WP_Mock::expectFilterAdded('user_contactmethods', 'CW\\Plugin\\Core\\filter_user_contactmethods');
     // Act.
     setup();
     // Verify.
     $this->assertConditionsMet();
 }
開發者ID:ChrisWiegman,項目名稱:chriswiegman-plugin,代碼行數:19,代碼來源:Core_Tests.php

示例8: test_handle_postback

 public function test_handle_postback()
 {
     $async = $this->getMockAsync('Async', array('verify_async_nonce', 'run_action'));
     $nonce = 'asdfasdf';
     $_POST['_nonce'] = $nonce;
     $async->shouldReceive('verify_async_nonce')->once()->with($nonce)->andReturn(true);
     WP_Mock::wpFunction('is_user_logged_in', array('times' => 1, 'return' => true));
     $async->shouldReceive('run_action')->once()->with();
     WP_Mock::expectFilterAdded('wp_die_handler', function () {
         die;
     });
     WP_Mock::wpFunction('wp_die', array('times' => 1));
     /** @var Async $async */
     $async->handle_postback();
     $action = new ReflectionProperty('Async', 'action');
     $action->setAccessible(true);
     $this->assertEquals('async', $action->getValue($async));
     $this->assertConditionsMet();
 }
開發者ID:AramZS,項目名稱:wp-async-task,代碼行數:19,代碼來源:WP-Async-TaskTest.php

示例9: test_safe_exit

 /**
  * Ensure the safe exit function adds the appropriate filters and
  * invokes `wp_die()` in the end.
  */
 public function test_safe_exit()
 {
     M::wpFunction('wp_die', ['times' => 1]);
     $handler = function () {
         return function () {
             die;
         };
     };
     M::expectFilterAdded('wp_die_ajax_handler', $handler);
     M::expectFilterAdded('wp_die_xmlrpc_handler', $handler);
     M::expectFilterAdded('wp_die_handler', $handler);
     safe_exit();
     $this->assertConditionsMet();
 }
開發者ID:ericmann,項目名稱:dovedi,代碼行數:18,代碼來源:Core_Tests.php

示例10: testAddedGalleryShortcodeParsing

 /**
  * 
  */
 public function testAddedGalleryShortcodeParsing()
 {
     \WP_Mock::expectFilterAdded('post_gallery', array($this->shortcodeParser, 'galleryCallback'), 0, 2);
     $this->shortcodeParser->addFilters();
 }
開發者ID:nomve,項目名稱:angular-press,代碼行數:8,代碼來源:ShortcodeParserTest.php


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