当前位置: 首页>>代码示例>>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;未经允许,请勿转载。