本文整理汇总了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));
}
示例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));
}
示例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);
}
示例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']));
}