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


PHP Request::expects方法代码示例

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


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

示例1: testHasUninstallAction

 /**
  * @param string $content
  * @param array $expected
  * @param bool $result
  * @dataProvider hasUninstallActionDataProvider
  */
 public function testHasUninstallAction($content, $expected, $result)
 {
     $this->request->expects($this->any())->method('getContent')->willReturn($content);
     $this->controller->setEvent($this->mvcEvent);
     $this->controller->dispatch($this->request, $this->response);
     $this->uninstallCollector->expects($this->once())->method('collectUninstall')->with(["some_module"])->willReturn($expected);
     $this->assertSame($result, $this->controller->hasUninstallAction()->getVariable("hasUninstall"));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:DataOptionTest.php

示例2: testUpdateActionSuccess

 public function testUpdateActionSuccess()
 {
     $content = '{"packages":[{"name":"vendor\\/package","version":"1.0"}],"type":"update",' . '"headerTitle": "Update package 1" }';
     $this->request->expects($this->any())->method('getContent')->willReturn($content);
     $this->payloadValidator->expects($this->once())->method('validatePayload')->willReturn('');
     $this->updaterTaskCreator->expects($this->once())->method('createUpdaterTasks')->willReturn('');
     $this->controller->setEvent($this->mvcEvent);
     $this->controller->dispatch($this->request, $this->response);
     $this->controller->updateAction();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:StartUpdaterTest.php

示例3: testOnDispatchErrorStripBaseUrl

 /**
  * @covers ::onDispatchError
  */
 public function testOnDispatchErrorStripBaseUrl()
 {
     $baseUrl = '/base';
     $path = '/some/uri';
     $uri = $baseUrl . $path;
     $this->event->setError(Application::ERROR_ROUTER_NO_MATCH);
     $this->request->expects($this->once())->method('getRequestUri')->willReturn($uri);
     $this->request->expects($this->once())->method('getBaseUrl')->willReturn($baseUrl);
     $this->manager->expects($this->once())->method('matchUri')->with($this->equalTo($path));
     $this->listener->onDispatchError($this->event);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:14,代码来源:ApplicationListenerTest.php

示例4: testUpdateActionSuccessDisable

 public function testUpdateActionSuccessDisable()
 {
     $content = '{"packages":[{"name":"vendor\\/package"}],"type":"disable",' . '"headerTitle": "Disable Package 1" }';
     $this->request->expects($this->any())->method('getContent')->willReturn($content);
     $this->fullModuleList->expects($this->once())->method('has')->willReturn(true);
     $write = $this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\Directory\\WriteInterface', [], '', false);
     $this->filesystem->expects($this->once())->method('getDirectoryWrite')->willReturn($write);
     $write->expects($this->once())->method('writeFile')->with('.type.json', '{"type":"disable","headerTitle":"Disable Package 1","titles":["D"]}');
     $this->controller->setEvent($this->mvcEvent);
     $this->controller->dispatch($this->request, $this->response);
     $this->controller->updateAction();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:StartUpdaterTest.php

示例5: testGetRedirectRouteFromRequest

 /**
  * @dataProvider providerGetRedirectRouteFromRequest
  */
 public function testGetRedirectRouteFromRequest($get, $post, $getRouteExists, $postRouteExists)
 {
     $expectedResult = false;
     $this->request->expects($this->once())->method('getQuery')->will($this->returnValue($get));
     if ($get) {
         $this->router->expects($this->any())->method('assemble')->with(array(), array('name' => $get))->will($getRouteExists);
         if ($getRouteExists == $this->returnValue(true)) {
             $expectedResult = $get;
         }
     }
     if (!$get || !$getRouteExists) {
         $this->request->expects($this->once())->method('getPost')->will($this->returnValue($post));
         if ($post) {
             $this->router->expects($this->any())->method('assemble')->with(array(), array('name' => $post))->will($postRouteExists);
             if ($postRouteExists == $this->returnValue(true)) {
                 $expectedResult = $post;
             }
         }
     }
     $method = new \ReflectionMethod('ZfcUser\\Controller\\RedirectCallback', 'getRedirectRouteFromRequest');
     $method->setAccessible(true);
     $result = $method->invoke($this->redirectCallback);
     $this->assertSame($expectedResult, $result);
 }
开发者ID:lafaiDev,项目名称:suive_com,代码行数:27,代码来源:RedirectCallbackTest.php

示例6: testGetBasePath

 public function testGetBasePath()
 {
     $this->request->expects($this->once())->method('getBasePath')->willReturn('/');
     $this->assertEquals('/', $this->zendRequestContext->getBasePath());
 }
开发者ID:fadoe,项目名称:symfony-asset-module,代码行数:5,代码来源:ZendRequestContextTest.php


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