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


PHP Curl::mockResult方法代码示例

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


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

示例1: test_mock

 function test_mock()
 {
     Curl::initMock();
     Curl::mockResult("helloworld");
     $curl = new Curl();
     $res = $curl->exec();
     $this->assertEquals($res, "helloworld");
 }
开发者ID:tunapanda,项目名称:wp-remote-sync,代码行数:8,代码来源:test-Curl.php

示例2: test_push

 function test_push()
 {
     RemoteSyncPlugin::instance()->install();
     $postId = wp_insert_post(array('post_content' => 'content', 'post_name' => 'the-slug', 'post_title' => "Hello Post"));
     update_option("rs_remote_site_url", "http://example.com/");
     Curl::mockResult(array());
     Curl::mockResult(array());
     Curl::mockResult(array());
     $op = new RemoteSyncOperations();
     $op->push();
     wp_trash_post($postId);
     Curl::initMock();
     Curl::mockResult(array(array("slug" => 'the-slug', 'revision' => "hello")));
     Curl::mockResult(array());
     Curl::mockResult(array());
     $op = new RemoteSyncOperations();
     $op->push();
 }
开发者ID:tunapanda,项目名称:wp-remote-sync,代码行数:18,代码来源:test-RemoteSyncOperations.php

示例3: test_state

 function test_state()
 {
     update_option("rs_remote_site_url", "helloworld");
     RemoteSyncPlugin::instance()->syncers = array(new SRTestSyncer("testType"));
     RemoteSyncPlugin::instance()->install();
     $syncer = RemoteSyncPlugin::instance()->getSyncerByType("testType");
     $data = $syncer->getResource("slug1");
     $rev = md5(json_encode($data));
     Curl::mockResult(array(array("slug" => "onlyremote", "revision" => "05a1ad082ad35cad7aac7b18e232feb3"), array("slug" => "slug1", "revision" => $rev)));
     $syncResources = SyncResource::findAllForType("testType", SyncResource::POPULATE_REMOTE | SyncResource::POPULATE_LOCAL);
     $a = array();
     foreach ($syncResources as $syncResource) {
         $a[$syncResource->getSlug()] = $syncResource;
     }
     //echo "l: ".sizeof($syncResources);
     $syncResource = $syncResources[0];
     $data = $syncResource->getData();
     $rev = $syncResource->getLocalRevision();
     $this->assertEquals($a["onlyremote"]->getState(), SyncResource::NEW_REMOTE);
     $this->assertEquals($a["onlylocal"]->getState(), SyncResource::NEW_LOCAL);
     $this->assertEquals($a["slug1"]->getState(), SyncResource::UP_TO_DATE);
 }
开发者ID:tunapanda,项目名称:wp-remote-sync,代码行数:22,代码来源:test-SyncResource.php


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