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


PHP Request::setMethod方法代码示例

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


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

示例1: testAction

 /**
  */
 public function testAction()
 {
     $queryName = uniqid('query');
     list($data, $expected) = $this->prepareDataAndExpected();
     $user = UserEntityProvider::createEntityWithRandomData();
     $request = new Request();
     $request->setMethod(Request::METHOD_GET);
     $request->setQuery(new Parameters(array('q' => $queryName)));
     $this->authControllerPluginMock->expects($this->once())->method('__invoke')->with(null)->will($this->returnSelf());
     $this->authControllerPluginMock->expects($this->once())->method('getUser')->willReturn($user);
     $this->organizationRepoMock->expects($this->once())->method('getTypeAheadResults')->with($queryName, $user)->willReturn($data);
     /** @var JsonModel $result */
     $result = $this->controller->dispatch($request);
     $this->assertResponseStatusCode(Response::STATUS_CODE_200);
     $this->assertSame($expected, $result->getVariables());
 }
开发者ID:webpants,项目名称:YAWIK,代码行数:18,代码来源:TypeAHeadControllerTest.php

示例2: testIndexAction_WithGetRequest_WhenUnexpectedExceptionOccurred

 public function testIndexAction_WithGetRequest_WhenUnexpectedExceptionOccurred()
 {
     $userId = uniqid('user');
     $request = new Request();
     $request->setMethod(Request::METHOD_GET);
     $this->routeMatch->setParam('userId', $userId);
     $this->serviceMock->expects($this->once())->method('proceed')->with($userId)->willThrowException(new \LogicException());
     $this->controller->dispatch($request);
     $this->assertResponseStatusCode(Response::STATUS_CODE_302);
     $this->assertRedirectTo('/en/auth/register');
     //$fm = $this->controller->flashMessenger();
     //$fm->setNamespace(Notification::NAMESPACE_DANGER);
     //$expectedMessages = array(
     //    'An unexpected error has occurred, please contact your system administrator'
     //);
     //$this->assertSame($expectedMessages, $fm->getCurrentMessages());
 }
开发者ID:webpants,项目名称:YAWIK,代码行数:17,代码来源:RegisterConfirmationControllerTest.php

示例3: testIndexAction_WithValidPostRequest

 public function testIndexAction_WithValidPostRequest()
 {
     $postData = array('name' => uniqid('name'), 'email' => uniqid('email') . '@' . uniqid('host') . '.com.pl');
     $request = new Request();
     $request->setMethod(Request::METHOD_POST);
     $request->setPost(new Parameters($postData));
     $this->formMock->expects($this->once())->method('setData')->with($postData);
     $this->formMock->expects($this->once())->method('isValid')->willReturn(true);
     $registerInputFilter = new RegisterInputFilter();
     $registerInputFilter->add(array('name' => 'captcha'));
     $this->formMock->expects($this->once())->method('getInputFilter')->willReturn($registerInputFilter);
     $this->serviceMock->expects($this->once())->method('proceed');
     $result = $this->controller->dispatch($request);
     $expected = array('form' => $this->formMock);
     $this->assertResponseStatusCode(Response::STATUS_CODE_200);
     $this->assertSame($expected, $result);
     // TODO: reactivate
     //$fm = $this->controller->flashMessenger();
     //$fm->setNamespace(Notification::NAMESPACE_SUCCESS);
     //$expectedMessages = array(
     //    'An Email with an activation link has been sent, please try to check your email box'
     //);
     //$this->assertSame($expectedMessages, $fm->getCurrentMessages());
 }
开发者ID:webpants,项目名称:YAWIK,代码行数:24,代码来源:RegisterControllerTest.php

示例4: testIndexAction_WithPostRequest

 public function testIndexAction_WithPostRequest()
 {
     $postData = array('identity' => uniqid('identity'));
     $request = new Request();
     $request->setMethod(Request::METHOD_POST);
     $request->setPost(new Parameters($postData));
     $this->formMock->expects($this->once())->method('setData')->with($postData);
     $this->formMock->expects($this->once())->method('isValid')->willReturn(true);
     $this->formMock->expects($this->once())->method('getInputFilter')->willReturn(new ForgotPasswordInputFilter());
     $this->serviceMock->expects($this->once())->method('proceed');
     $result = $this->controller->dispatch($request);
     $expected = array('form' => $this->formMock);
     $this->assertResponseStatusCode(Response::STATUS_CODE_200);
     $this->assertSame($expected, $result);
     //$fm = $this->controller->flashMessenger();
     //$fm->setNamespace(Notification::NAMESPACE_SUCCESS);
     //$expectedMessages = array(
     //    'Mail with link for reset password has been sent, please try to check your email box'
     //);
     //$this->assertSame($expectedMessages, $fm->getCurrentMessages());
 }
开发者ID:utrenkner,项目名称:YAWIK,代码行数:21,代码来源:ForgotPasswordControllerTest.php

示例5: testIndexAction_WithPostRequest

 public function testIndexAction_WithPostRequest()
 {
     $postData = array('valid data');
     $request = new Request();
     $request->setMethod(Request::METHOD_POST);
     $request->setPost(new Parameters($postData));
     $userEntity = UserEntityProvider::createEntityWithRandomData();
     $this->authenticationServiceMock->expects($this->once())->method('getUser')->willReturn($userEntity);
     $this->formMock->expects($this->once())->method('bind')->with($userEntity);
     $this->formMock->expects($this->once())->method('setData')->with($postData);
     $this->formMock->expects($this->once())->method('isValid')->willReturn(true);
     $this->repositoriesMock->expects($this->once())->method('store')->with($userEntity);
     $result = $this->controller->dispatch($request);
     $expected = array('valid' => true, 'form' => $this->formMock);
     $this->assertResponseStatusCode(Response::STATUS_CODE_200);
     $this->assertSame($expected, $result);
 }
开发者ID:utrenkner,项目名称:YAWIK,代码行数:17,代码来源:PasswordControllerTest.php


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