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


PHP CakeRequest::addPaths方法代碼示例

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


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

示例1: testAddPaths

 /**
  * Test splicing in paths.
  *
  * @return void
  */
 public function testAddPaths()
 {
     $request = new CakeRequest('some/path');
     $request->webroot = '/some/path/going/here/';
     $result = $request->addPaths(array('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:xMyThoLoGyx,項目名稱:centremedicaletp3,代碼行數:16,代碼來源:CakeRequestTest.php

示例2: testAfterLayout

 /**
  * Test afterlayout element rendering
  *
  * @return void
  */
 public function testAfterLayout()
 {
     $this->Controller->viewPath = 'Posts';
     $request = new CakeRequest('/posts/index');
     $request->addParams(Router::parse($request->url));
     $request->addPaths(array('webroot' => '/', 'base' => '/', 'here' => '/posts/index'));
     $this->Controller->setRequest($request);
     $this->Controller->layout = 'default';
     $this->Controller->uses = null;
     $this->Controller->components = array('DebugKit.Toolbar');
     $this->Controller->constructClasses();
     $this->Controller->Components->trigger('startup', array($this->Controller));
     $this->Controller->Components->trigger('beforeRender', array($this->Controller));
     $result = $this->Controller->render();
     $this->assertNotRegExp('/debug-toolbar/', (string) $result);
     $result = $this->firecake->sentHeaders;
     $this->assertTrue(is_array($result));
 }
開發者ID:hupla78,項目名稱:Nadia,代碼行數:23,代碼來源:FirePhpToolbarHelperTest.php

示例3: testJavascriptInjection

 /**
  * test injection of javascript
  *
  * @return void
  **/
 public function testJavascriptInjection()
 {
     $this->Controller->viewPath = 'posts';
     $this->Controller->uses = null;
     $request = new CakeRequest('/posts/index');
     $request->addParams(Router::parse($request->url));
     $request->addPaths(array('webroot' => '/', 'base' => '/', 'here' => '/posts/index'));
     $this->Controller->setRequest($request);
     $this->Controller->helpers = array('Js', 'Html', 'Session');
     $this->Controller->components = array('DebugKit.Toolbar');
     $this->Controller->layout = 'default';
     $this->Controller->constructClasses();
     $this->Controller->Components->trigger('startup', array($this->Controller));
     $this->Controller->Components->trigger('beforeRender', array($this->Controller));
     $result = $this->Controller->render();
     $result = str_replace(array("\n", "\r"), '', $result);
     $this->assertPattern('#<script\\s*type="text/javascript"\\s*src="/debug_kit/js/js_debug_toolbar.js(:?\\?\\d*?)?"\\s*>\\s?</script>#', $result);
 }
開發者ID:omusico,項目名稱:RentSquare,代碼行數:23,代碼來源:HtmlToolbarHelperTest.php

示例4: testRenderTimers

 /**
  * test rendering and ensure that timers are being set.
  *
  * @return void
  */
 public function testRenderTimers()
 {
     $request = new CakeRequest('/posts/index');
     $request->addParams(Router::parse($request->url));
     $request->addPaths(array('webroot' => '/', 'base' => '/', 'here' => '/posts/index'));
     $this->Controller->setRequest($request);
     $this->Controller->viewPath = 'posts';
     $this->Controller->layout = 'default';
     $View = new DebugView($this->Controller, false);
     $View->render('index');
     $result = DebugKitDebugger::getTimers();
     $this->assertEqual(count($result), 4);
     $this->assertTrue(isset($result['viewRender']));
     $this->assertTrue(isset($result['render_default.ctp']));
     $this->assertTrue(isset($result['render_index.ctp']));
     $result = DebugKitDebugger::getMemoryPoints();
     $this->assertTrue(isset($result['View render complete']));
 }
開發者ID:omusico,項目名稱:RentSquare,代碼行數:23,代碼來源:DebugViewTest.php


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