當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::addPaths方法代碼示例

本文整理匯總了PHP中Cake\Network\Request::addPaths方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::addPaths方法的具體用法?PHP Request::addPaths怎麽用?PHP Request::addPaths使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\Network\Request的用法示例。


在下文中一共展示了Request::addPaths方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDefaultToLoginRedirect

 /**
  * Default to loginRedirect, if set, on authError.
  *
  * @return void
  * @triggers Controller.startup $Controller
  */
 public function testDefaultToLoginRedirect()
 {
     $url = '/party/on';
     $this->Auth->request = $request = new Request($url);
     $request->env('HTTP_REFERER', false);
     $request->addParams(Router::parse($url));
     $request->addPaths(['base' => 'dirname', 'webroot' => '/dirname/']);
     Router::pushRequest($request);
     $this->Auth->config('authorize', ['Controller']);
     $this->Auth->setUser(['username' => 'mariano', 'password' => 'cake']);
     $this->Auth->config('loginRedirect', ['controller' => 'something', 'action' => 'else']);
     $response = new Response();
     $Controller = $this->getMock('Cake\\Controller\\Controller', ['on', 'redirect'], [$request, $response]);
     $event = new Event('Controller.startup', $Controller);
     // Should not contain basedir when redirect is called.
     $expected = '/something/else';
     $Controller->expects($this->once())->method('redirect')->with($this->equalTo($expected));
     $this->Auth->startup($event);
 }
開發者ID:Rabp9,項目名稱:test-psi2,代碼行數:25,代碼來源:AuthComponentTest.php

示例2: testAddPaths

 /**
  * Test splicing in paths.
  *
  * @return void
  */
 public function testAddPaths()
 {
     $request = new Request();
     $request->webroot = '/some/path/going/here/';
     $result = $request->addPaths(['random' => '/something', 'webroot' => '/', 'here' => '/', 'base' => '/base_dir']);
     $this->assertSame($result, $request, 'Method did not return itself. %s');
     $this->assertEquals('/', $request->webroot);
     $this->assertEquals('/base_dir', $request->base);
     $this->assertEquals('/', $request->here);
     $this->assertFalse(isset($request->random));
 }
開發者ID:alexunique0519,項目名稱:Blog_Cakephp_association,代碼行數:16,代碼來源:RequestTest.php


注:本文中的Cake\Network\Request::addPaths方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。