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


PHP MockPlugin::getReceivedRequests方法代码示例

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


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

示例1: testScales

 /**
  * @param string $expectedEncodedScales
  * @param array  $scales
  *
  * @dataProvider scaleDataProvider
  */
 public function testScales($expectedEncodedScales, $scales)
 {
     $this->clientMocker->addResponse(new Response(200, null, '{"statusCode":200,"response":{"results":[]},"msecs":1}'));
     $this->engineClient->find(10, array(), $scales, array());
     $fields = current($this->clientMocker->getReceivedRequests())->getPostFields();
     $this->assertEquals($expectedEncodedScales, $fields['scales']);
 }
开发者ID:benjy,项目名称:sajari-sdk-php,代码行数:13,代码来源:EngineClientTest.php

示例2: testGetRequestToken

 public function testGetRequestToken()
 {
     $callbackUrl = 'http://www.example.com/twitter/callback';
     $this->factoryMock->expects($this->once())->method('getOAuthConnection')->with()->will($this->returnValue($this->bootstrapClient()));
     $this->mockPlugin->addResponse(__DIR__ . '/fixtures/request_token.txt');
     $requestToken = $this->bootstrapGateway()->getRequestToken($callbackUrl);
     $this->assertEquals('foo', $requestToken['oauth_token']);
     $this->assertEquals('bar', $requestToken['oauth_token_secret']);
     $receivedRequests = $this->mockPlugin->getReceivedRequests();
     $this->assertCount(1, $receivedRequests);
     $this->assertEquals($callbackUrl, $receivedRequests[0]->getHeader('oauth_callback'));
 }
开发者ID:derrabus,项目名称:twitter-signin-bundle,代码行数:12,代码来源:TwitterApiGatewayTest.php

示例3: testListTasksWithNonUtf8Response

    /**
     * method : listTasks
     * case : search a task with a label job_label
     */
    public function testListTasksWithNonUtf8Response()
    {
        $this->mock->addResponse(new Response(200, array('Content-Type' => 'application/json'), utf8_decode(<<<BODY
{
    "result": [{
        "label": "àéèjob_label"
    }],
    "returnCode": 0
}
BODY
)));
        $return = $this->client->listTasks();
        $requests = $this->mock->getReceivedRequests();
        $this->assertCount(1, $requests);
        $request = reset($requests);
        $this->assertEquals(0, $return['returnCode']);
        $this->assertEquals('http://talend.url/org.talend.administrator/metaServlet?eyJhY3Rpb25OYW1lIjoibGlzdFRhc2tzIiwiYXV0aFBhc3MiOiJwYXNzd29yZCIsImF1dGhVc2VyIjoibG9naW4iLCJtb2RlIjoic3luY2hyb25vdXMifQ=%3D', $request->getUrl());
        $taskLabels = array();
        if (!empty($return['result'])) {
            foreach ($return['result'] as $task) {
                $taskLabels[] = $task['label'];
            }
        }
        $this->assertTrue(array_search('àéèjob_label', $taskLabels) !== false);
    }
开发者ID:lafourchette,项目名称:talend-php-sdk,代码行数:29,代码来源:TalendClientTest.php

示例4: iShouldNotSeeAMessageInTheChannel

 /**
  * @Given /^I should not see a message in the channel$/
  */
 public function iShouldNotSeeAMessageInTheChannel()
 {
     $requests = $this->plugin->getReceivedRequests();
     if (count($requests)) {
         throw new \Exception('Did not expect to see any API calls made.');
     }
 }
开发者ID:orukusaki,项目名称:slackbundle,代码行数:10,代码来源:SlackContext.php

示例5: assertGuzzleRequest

 /**
  * @return EntityEnclosingRequestInterface
  */
 protected function assertGuzzleRequest()
 {
     $requests = $this->guzzleMockPlugin->getReceivedRequests();
     if (empty($requests)) {
         throw new \PHPUnit_Framework_ExpectationFailedException("No Guzzle request to evaluate");
     }
     return $requests[0];
 }
开发者ID:ThemeSurgeon,项目名称:launchkey-php,代码行数:11,代码来源:GuzzleApiServiceTestAbstract.php

示例6: testSendsRequests

 /**
  * @dataProvider requestProvider
  */
 public function testSendsRequests($method)
 {
     $mock = new MockPlugin(array(new Response(200)));
     call_user_func('Guzzle\\Http\\StaticClient::' . $method, 'http://foo.com', array('plugins' => array($mock)));
     $requests = $mock->getReceivedRequests();
     $this->assertCount(1, $requests);
     $this->assertEquals($method, $requests[0]->getMethod());
 }
开发者ID:alvarobfdev,项目名称:applog,代码行数:11,代码来源:StaticClientTest.php

示例7: it_can_create_a_collaboration_link

 /**
  * @test
  */
 public function it_can_create_a_collaboration_link()
 {
     $response = (new Response(200))->setBody(file_get_contents(__DIR__ . '/samples/LinkCreated.xml'));
     $this->mockPlugin->addResponse($response);
     $eventId = '004aea08-e13d-48c9-b9eb-a18f20e6d44e';
     $language = new Language('en');
     $subBrand = "myBrand";
     $description = "description";
     $plainText = "plaintext";
     $rsp = $this->entryAPI->createCollaborationLink($eventId, $language, $subBrand, $description, $plainText);
     $requests = $this->mockPlugin->getReceivedRequests();
     /** @var RequestInterface|MessageInterface|EntityEnclosingRequestInterface $request */
     $request = reset($requests);
     $this->assertEquals('POST', $request->getMethod());
     $this->assertEquals('http://example.com/event/004aea08-e13d-48c9-b9eb-a18f20e6d44e/links', $request->getUrl());
     $this->assertEquals('application/x-www-form-urlencoded', (string) $request->getHeader('Content-Type'));
     $this->assertEquals('lang=en&plaintext=plaintext&linktype=collaboration&subbrand=myBrand&description=description', (string) $request->getPostFields());
     $expectedRsp = new Rsp('0.1', Rsp::LEVEL_INFO, 'LinkCreated', 'http://test.rest.uitdatabank.be/api/v3/event/004aea08-e13d-48c9-b9eb-a18f20e6d44e', '');
     $this->assertEquals($expectedRsp, $rsp);
 }
开发者ID:cultuurnet,项目名称:entry,代码行数:23,代码来源:EntryAPITest.php

示例8: getRequests

 /**
  * @return array|Request[]
  */
 protected function getRequests()
 {
     return $this->mock->getReceivedRequests();
 }
开发者ID:ataxel,项目名称:tp,代码行数:7,代码来源:VarnishTest.php

示例9: getRequest

 /**
  * @param MockPlugin $plugin
  *
  * @return RequestInterface
  */
 protected function getRequest(MockPlugin $plugin)
 {
     $requests = $plugin->getReceivedRequests();
     return reset($requests);
 }
开发者ID:ulkas,项目名称:bcc-myrrix,代码行数:10,代码来源:MyrrixClientTest.php


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