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


PHP UriInterface::method方法代码示例

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


在下文中一共展示了UriInterface::method方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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\UriInterface::method方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。