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


PHP RequestInterface::method方法代码示例

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


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

示例1: shouldCatchInvalidBody

 /** @test */
 public function shouldCatchInvalidBody()
 {
     $body = $this->getMock('\\Psr\\Http\\Message\\StreamInterface');
     $body->method('getContents')->willReturn('{"title":"Aaa"}');
     $this->request->method('getMethod')->willReturn('post');
     $this->uri->method('getPath')->willReturn('/songs');
     $this->request->method('getHeaderLine')->with('Content-Type')->willReturn('application/json');
     $this->request->method('getBody')->willReturn($body);
     $this->setExpectedException('\\Raml\\Validator\\ValidatorRequestException', 'title (minLength), artist (required)');
     $validator = $this->getValidatorForSchema(__DIR__ . '/../fixture/validator/requestBody.raml');
     $validator->validateRequest($this->request);
 }
开发者ID:alecsammon,项目名称:php-raml-parser,代码行数:13,代码来源:RequestValidatorTest.php

示例2: testDestructorCallsCurlCloseOnUsedObject

 public function testDestructorCallsCurlCloseOnUsedObject()
 {
     $uriMock = $this->getMockForAbstractClass('\\Psr\\Http\\Message\\UriInterface');
     $uriMock->method('getScheme')->willReturn('ftp');
     $this->request->method('getUri')->willReturn($uriMock);
     $this->getFunctionMock(self::SUT_NAMESPACE, 'curl_exec')->expects($this->any())->willReturn(true);
     $this->getFunctionMock(self::SUT_NAMESPACE, 'curl_setopt_array')->expects($this->any())->willReturn(true);
     $this->subjectUnderTest->execute();
     $this->getFunctionMock(self::SUT_NAMESPACE, 'curl_close')->expects($this->atLeastOnce());
     $this->subjectUnderTest->__destruct();
 }
开发者ID:kiler129,项目名称:TorrentGhost,代码行数:11,代码来源:FetchJobTest.php

示例3: shouldCatchInvalidBody

 /** @test */
 public function shouldCatchInvalidBody()
 {
     $json = '{}';
     $headers = ['X-Required-Header' => ['123456'], 'X-Long-Optional-Header' => ['Abcdefghijkl']];
     $map = [['X-Required-Header', [['123456']]], ['X-Long-Optional-Header', [['Abcdefg', 'Abc']]]];
     $body = $this->getMock('\\Psr\\Http\\Message\\StreamInterface');
     $body->method('getContents')->willReturn($json);
     $this->request->method('getMethod')->willReturn('post');
     $this->uri->method('getPath')->willReturn('/songs');
     $this->response->method('getStatusCode')->willReturn(200);
     $this->response->method('getHeader')->willReturnMap($map);
     $this->response->method('getHeaders')->willReturn($headers);
     $this->response->method('getHeaderLine')->with('Content-Type')->willReturn('application/json');
     $this->response->method('getBody')->willReturn($body);
     $this->setExpectedException('\\Raml\\Validator\\ValidatorResponseException', 'title (required), artist (required)');
     $validator = $this->getValidatorForSchema(__DIR__ . '/../fixture/validator/responseBody.raml');
     $validator->validateResponse($this->request, $this->response);
 }
开发者ID:alecsammon,项目名称:php-raml-parser,代码行数:19,代码来源:ResponseValidatorTest.php


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