當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。