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


PHP WP_Mock::wpPassthruFunction方法代码示例

本文整理汇总了PHP中WP_Mock::wpPassthruFunction方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Mock::wpPassthruFunction方法的具体用法?PHP WP_Mock::wpPassthruFunction怎么用?PHP WP_Mock::wpPassthruFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Mock的用法示例。


在下文中一共展示了WP_Mock::wpPassthruFunction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     // We are not testing escaping functions so let them passthrough
     \WP_Mock::wpPassthruFunction('absint');
     \WP_Mock::wpPassthruFunction('esc_url');
 }
开发者ID:CondeNast,项目名称:purgely,代码行数:7,代码来源:HeaderCacheControlTest.php

示例2: test_get_field

 /**
  * @covers       tfrommen\ThatWasHelpful\Models\Nonce::get_field
  * @dataProvider provide_get_data
  *
  * @param string $response
  * @param string $action
  */
 public function test_get_field($response, $action)
 {
     $testee = new Testee('class_action');
     WP_Mock::wpPassthruFunction('wp_nonce_field', array('times' => 1, 'args' => array(WP_Mock\Functions::type('string'), WP_Mock\Functions::type('string'), WP_Mock\Functions::type('bool'), WP_Mock\Functions::type('bool'))));
     $this->assertSame($response, $testee->get_field($action));
     $this->assertConditionsMet();
 }
开发者ID:tfrommen,项目名称:that-was-helpful,代码行数:14,代码来源:NonceModelTest.php

示例3: test_load_message_scenarios

 public function test_load_message_scenarios()
 {
     $defaults = array('days' => 30, 'limit' => 50);
     $_GET = array('nonce' => true);
     $_POST = $defaults;
     $instance = Mockery::mock('RevisionStrike')->makePartial();
     $instance->shouldReceive('strike')->with($defaults);
     $instance->shouldReceive('get_stats')->times(3)->andReturn(array('count' => 0), array('count' => 5, 'deleted' => 0), array('count' => 5, 'deleted' => 5));
     M::wpFunction('wp_verify_nonce', array('return' => true));
     M::wpFunction('_n', array('times' => 1, 'return' => '%d post revisions'));
     M::wpPassthruFunction('wp_nonce_url');
     M::wpPassthruFunction('submit_button');
     // Pass 1: no revisions found
     ob_start();
     include $this->tools_file;
     $result = ob_get_contents();
     ob_end_clean();
     $this->assertContains('<div class="error"><p>', $result, 'No revisions found did not trigger an error message');
     // Pass 2: revisions found, but nothing deleted
     ob_start();
     include $this->tools_file;
     $result = ob_get_contents();
     ob_end_clean();
     $this->assertContains('<div class="error"><p>', $result, 'The user should be warned when revisions were found be we can\'t delete them');
     // Pass 3: revisions deleted successfully
     ob_start();
     include $this->tools_file;
     $result = ob_get_contents();
     ob_end_clean();
     $this->assertContains('<div class="updated"><p>', $result, 'Notify the user when revisions are deleted');
     $this->assertContains('5 post revisions', $result, 'Display the number of revisions that were removed.');
     unset($_GET, $_POST);
 }
开发者ID:stevegrunwell,项目名称:revision-strike,代码行数:33,代码来源:ToolsTest.php

示例4: test_getter_exception

 /**
  * Invalid items in the getter should return a WP_Error instance
  */
 public function test_getter_exception()
 {
     require_once 'dummy-files/wp_error.php';
     \WP_Mock::wpPassthruFunction('__');
     $context = new WP_TemplateContext();
     $context->invalid;
     $this->assertInstanceOf('WP_Error', $context->invalid);
 }
开发者ID:ericmann,项目名称:mvpress,代码行数:11,代码来源:contextTest.php

示例5: test_register

 public function test_register()
 {
     $testee = new Testee();
     WP_Mock::wpPassthruFunction('_x', array('args' => array(WP_Mock\Functions::type('string'), WP_Mock\Functions::type('string'), 'external-content')));
     WP_Mock::wpPassthruFunction('__', array('args' => array(WP_Mock\Functions::type('string'), 'external-content')));
     WP_Mock::wpFunction('register_post_type', array('times' => 1, 'args' => array('external_content', WP_Mock\Functions::type('array'))));
     $testee->register();
     $this->assertConditionsMet();
 }
开发者ID:tfrommen,项目名称:external-content,代码行数:9,代码来源:PostTypeModelTest.php

示例6: testBuildPostTypeExpectsRegisterPostTypeCalledOnce

 function testBuildPostTypeExpectsRegisterPostTypeCalledOnce()
 {
     // Arrange
     $PostTypeObj = new PostTypeObj();
     \WP_Mock::wpPassthruFunction('wp_parse_args', array('times' => 1));
     \WP_Mock::wpPassthruFunction('register_post_type', array('times' => 1));
     // Act
     $PostTypeObj->build_post_type('Custom', 'Customs', 'custom', $prefix = 'cfpb_', $args = array('has_archive' => false, 'rewrite' => array('slug' => 'regulations', 'with_front' => false), 'supports' => array('title', 'editor', 'revisions', 'page-attributes', 'custom-fields')));
 }
开发者ID:vccabral,项目名称:cms-toolkit,代码行数:9,代码来源:test-post-types.php

示例7: test_init

 /**
  * Test theme setup
  *
  * @since 5.0.0
  */
 function test_init()
 {
     // Setup.
     \WP_Mock::wpPassthruFunction('remove_action');
     \WP_Mock::expectActionAdded('after_setup_theme', 'CW\\Theme\\Functions\\Core\\action_after_setup_theme');
     // Act.
     init();
     // Verify.
     $this->assertConditionsMet();
 }
开发者ID:ChrisWiegman,项目名称:chriswiegman-theme,代码行数:15,代码来源:Core_Tests.php

示例8: test_srcset_replacement_no_protocol_cdn

 public function test_srcset_replacement_no_protocol_cdn()
 {
     $manager = Base\DomainManager('http://test1.com');
     $manager->add('cdn1.com');
     // Mocks
     M::wpFunction('is_ssl', ['return' => false]);
     M::wpPassthruFunction('esc_url');
     $source = ['url' => 'http://test1.com/image.jpg'];
     $replacer = srcset_replacer('http://test1.com');
     $this->assertEquals('http://cdn1.com/image.jpg', $replacer($source)['url']);
 }
开发者ID:ericmann,项目名称:dynamic-cdn,代码行数:11,代码来源:Core_Tests.php

示例9: plugin

 protected function plugin()
 {
     // functions used as part of constructor
     Mock::wpPassthruFunction('untrailingslashit');
     Mock::wpFunction('plugin_dir_path', array('args' => bootstrap()->get_framework_path() . '/woocommerce/class-sv-wc-plugin.php', 'return' => bootstrap()->get_framework_path() . '/woocommerce'));
     Mock::wpFunction('is_admin', array('return' => true));
     Mock::wpPassthruFunction('plugin_basename');
     Mock::wpFunction('has_action', array('return' => true));
     $args = array('mock', '7.7.7', 'woocommerce-mock', 'args' => array('dependencies' => 'json', 'function_dependencies' => 'ftp_ssl_connect'));
     return $this->getMockBuilder('SV_WC_Plugin')->setConstructorArgs($args)->getMockForAbstractClass();
 }
开发者ID:shredzjc,项目名称:wc-plugin-framework,代码行数:11,代码来源:plugin.php

示例10: test_load

 /**
  * @covers tfrommen\ThatWasHelpful\Models\TextDomain::load
  *
  * @return void
  */
 public function test_load()
 {
     $file = '/path/to/file.php';
     $domain = 'text-domain';
     $path = '/domain';
     WP_Mock::wpPassthruFunction('plugin_basename', array('times' => 1, 'args' => array(WP_Mock\Functions::type('string'))));
     $testee = new Testee($file, $domain, $path);
     $path = dirname($file) . $path;
     WP_Mock::wpFunction('load_plugin_textdomain', array('times' => 1, 'args' => array($domain, FALSE, $path)));
     $testee->load();
     $this->assertConditionsMet();
 }
开发者ID:tfrommen,项目名称:that-was-helpful,代码行数:17,代码来源:TextDomainModelTest.php

示例11: test_init_widgets

 public function test_init_widgets()
 {
     $widget = new Widget();
     \WP_Mock::expectActionAdded('widgets_init', array($widget, 'registerWidgets'));
     $widget->init();
     \WP_Mock::wpPassthruFunction('register_widget', array('times' => 1, 'args' => array('Lnh\\Widget\\LastMatch\\LastMatch')));
     \WP_Mock::wpPassthruFunction('register_widget', array('times' => 1, 'args' => array('Lnh\\Widget\\NextMatch\\NextMatch')));
     \WP_Mock::wpPassthruFunction('register_widget', array('times' => 1, 'args' => array('Lnh\\Widget\\Calendar\\Calendar')));
     \WP_Mock::wpPassthruFunction('register_widget', array('times' => 1, 'args' => array('Lnh\\Widget\\Calendar\\Short\\CalendarShort')));
     \WP_Mock::wpPassthruFunction('register_widget', array('times' => 1, 'args' => array('Lnh\\Widget\\Classement\\Classement')));
     $widget->registerWidgets();
 }
开发者ID:CouleurCitron,项目名称:wp-lnh-flux,代码行数:12,代码来源:WidgetTest.php

示例12: test_domain_replacement_mixed

 public function test_domain_replacement_mixed()
 {
     $manager = DomainManager('http://test.com');
     $manager->add('https://cdn1.com');
     $original = 'http://test.com/image.png';
     $expected = 'https://cdn1.com/image.png';
     // Mocks
     M::wpFunction('is_ssl', ['return' => false]);
     M::wpPassthruFunction('esc_url');
     // Verify
     $this->assertEquals($expected, $manager->new_url($original));
 }
开发者ID:ericmann,项目名称:dynamic-cdn,代码行数:12,代码来源:DomainManagerTests.php

示例13: testLoginTransientExpectsTransientSet

 function testLoginTransientExpectsTransientSet()
 {
     $user_obj = new StdClass();
     $user_obj->ID = 1;
     $L = new \gboone\LoginLockout();
     \WP_Mock::wpFunction('set_transient', array('times' => 1));
     \WP_Mock::wpPassthruFunction('wp_die');
     $user_id = \WP_Mock::wpFunction('get_user_by', array('times' => 1, 'args' => array('slug', 'user'), 'return' => $user_obj));
     \WP_Mock::wpFunction('get_transient', array('times' => 1, 'return' => false));
     // Act
     $L->login_transient('user');
     // Test fails if set_transient isn't called
 }
开发者ID:vccabral,项目名称:login-lockout,代码行数:13,代码来源:test-login-lockout.php

示例14: test_save_item_multiple

 public function test_save_item_multiple()
 {
     $importer = new Import($this->createItem(10));
     \WP_Mock::wpPassthruFunction('get_posts', array('times' => 1));
     \WP_Mock::wpPassthruFunction('wp_insert_post', array('times' => 1));
     \WP_Mock::wpPassthruFunction('update_post_meta', array('times' => 10));
     $importer->save();
     $importer->setItem($this->createItem(5));
     \WP_Mock::wpPassthruFunction('get_posts', array('times' => 1));
     \WP_Mock::wpPassthruFunction('wp_insert_post', array('times' => 1));
     \WP_Mock::wpPassthruFunction('update_post_meta', array('times' => 5));
     $importer->save();
 }
开发者ID:CouleurCitron,项目名称:wp-lnh-flux,代码行数:13,代码来源:ImportTest.php

示例15: test_filter_user_contactmethods

 /**
  * Test filter_user_contactmethods
  *
  * @since 4.0.0
  */
 public function test_filter_user_contactmethods()
 {
     // Setup.
     \WP_Mock::wpPassthruFunction('esc_html__');
     // Act.
     $contact_methods = filter_user_contactmethods(array());
     // Verify.
     $this->assertTrue(is_array($contact_methods));
     $this->assertArrayHasKey('website_title', $contact_methods);
     $this->assertArrayHasKey('twitter', $contact_methods);
     $this->assertArrayHasKey('facebook', $contact_methods);
     $this->assertArrayHasKey('wordpress', $contact_methods);
     $this->assertArrayHasKey('github', $contact_methods);
 }
开发者ID:ChrisWiegman,项目名称:chriswiegman-plugin,代码行数:19,代码来源:Core_Tests.php


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