本文整理汇总了PHP中Router::reload方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::reload方法的具体用法?PHP Router::reload怎么用?PHP Router::reload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Router
的用法示例。
在下文中一共展示了Router::reload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
Configure::write('Routing.prefixes', ['admin']);
Router::reload();
$this->Html = new HtmlExtHelper(new View(null));
}
示例2: testIs
public function testIs()
{
$result = Reveal::is('App.online');
$expected = !in_array(gethostbyname('google.com'), array('google.com', false));
$this->assertEqual($result, $expected);
$result = Reveal::is('DebugKit.loaded');
$expected = CakePlugin::loaded('DebugKit');
$this->assertEqual($result, $expected);
$result = Reveal::is(array('OR' => array('DebugKit.enabled', 'DebugKit.automated')));
$expected = Configure::read('debug') || Configure::read('DebugKit.forceEnable') || Configure::read('DebugKit.autoRun');
$this->assertEqual($result, $expected);
$_GET['debug'] = 'true';
$this->assertTrue(Reveal::is('DebugKit.requested'));
$result = Reveal::is('DebugKit.loaded', array('OR' => array('DebugKit.enabled', array('AND' => array('DebugKit.automated', 'DebugKit.requested')))));
$expected = CakePlugin::loaded('DebugKit') || Configure::read('debug') || Configure::read('DebugKit.forceEnable') || Configure::read('DebugKit.autoRun') && isset($_GET['debug']) && 'true' == $_GET['debug'];
$this->assertEqual($result, $expected);
$this->assertEqual(Reveal::is('DebugKit.running'), $expected);
$request = new CakeRequest();
Router::setRequestInfo($request->addParams(array('controller' => 'pages', 'action' => 'display', 'pass' => array('home'))));
$result = Reveal::is('Page.front');
$this->assertTrue($result);
Router::reload();
$request = new CakeRequest();
Router::setRequestInfo($request->addParams(array('prefix' => 'admin', 'admin' => true)));
$result = Reveal::is('Page.prefixed');
$this->assertTrue($result);
Router::reload();
$request = new CakeRequest();
Router::setRequestInfo($request->addParams(array('controller' => 'users', 'action' => 'login')));
$result = Reveal::is('Page.login');
$this->assertTrue($result);
$this->assertTrue(Reveal::is('Page.test'));
}
示例3: _getRequest
/**
* 指定されたURLに対応しRouterパース済のCakeRequestのインスタンスを返す
*
* @param string $url URL
* @return CakeRequest
*/
protected function _getRequest($url)
{
Router::reload();
$request = new CakeRequest($url);
// コンソールからのテストの場合、requestのパラメーターが想定外のものとなってしまうので調整
if (isConsole()) {
$baseUrl = Configure::read('App.baseUrl');
if ($request->url === false) {
$request->here = $baseUrl . '/';
} elseif (preg_match('/^' . preg_quote($request->webroot, '/') . '/', $request->here)) {
$request->here = $baseUrl . '/' . preg_replace('/^' . preg_quote($request->webroot, '/') . '/', '', $request->here);
}
if ($baseUrl) {
if (preg_match('/^\\//', $baseUrl)) {
$request->base = $baseUrl;
} else {
$request->base = '/' . $baseUrl;
}
$request->webroot = $baseUrl;
} else {
$request->base = '';
$request->webroot = '/';
}
}
Router::setRequestInfo($request);
$params = Router::parse($request->url);
$request->addParams($params);
return $request;
}
示例4: setUp
/**
* start a test
*
* @return void
*/
public function setUp() {
parent::setUp();
$this->_pluginPath = App::pluginPath('AssetCompress');
$this->_testFiles = $this->_pluginPath . 'Test' . DS . 'test_files' . DS;
$testFile = $this->_testFiles . 'Config' . DS . 'config.ini';
AssetConfig::clearAllCachedKeys();
Cache::drop(AssetConfig::CACHE_CONFIG);
Cache::config(AssetConfig::CACHE_CONFIG, array(
'path' => TMP,
'prefix' => 'asset_compress_test_',
'engine' => 'File'
));
$controller = null;
$request = new CakeRequest(null, false);
$request->webroot = '';
$view = new View($controller);
$view->request = $request;
$this->Helper = new AssetCompressHelper($view, array('noconfig' => true));
$Config = AssetConfig::buildFromIniFile($testFile);
$this->Helper->config($Config);
$this->Helper->Html = new HtmlHelper($view);
Router::reload();
Configure::write('debug', 2);
}
示例5: setUp
public function setUp()
{
parent::setUp();
Router::reload();
$this->View = new View();
$this->Flash = new FlashHelper($this->View);
}
示例6: tearDown
/**
* tearDown
*
* @return void
*/
public function tearDown()
{
unset($this->BlogBaser);
unset($this->BlogContent);
Router::reload();
parent::tearDown();
}
示例7: _loadRoutes
/**
* Loads routes and resets if the test case dictates it should
*
* @return void
*/
protected function _loadRoutes()
{
parent::_loadRoutes();
if (!$this->loadRoutes) {
Router::reload();
}
}
示例8: setUp
function setUp()
{
Router::reload();
$this->PostsController = new PostsController();
$this->PostsController->index();
$this->view = new View($this->PostsController);
}
示例9: tearDown
/**
* tearDown
*
* @return void
*/
public function tearDown()
{
unset($this->Toolbar, $this->Controller);
ClassRegistry::flush();
Router::reload();
TestFireCake::reset();
}
示例10: setUp
public function setUp()
{
parent::setUp();
Router::reload();
$View = new View(null);
$this->Common = new CommonHelper($View);
$this->Html = new CommonHelper($View);
}
示例11: tearDown
public function tearDown()
{
parent::tearDown();
Configure::write('Security', $this->_initialState['Security']);
Configure::write('Opauth', $this->_initialState['Opauth']);
Router::reload();
unset($this->Controller);
}
示例12: startTest
/**
* start a test
*
* @return void
**/
function startTest()
{
$this->_pluginPath = App::pluginPath('AssetCompress');
$testFile = $this->_pluginPath . 'tests' . DS . 'test_files' . DS . 'config' . DS . 'config.ini';
$this->Helper = new AssetCompressHelper(array('iniFile' => $testFile));
$this->Helper->Html = new HtmlHelper();
Router::reload();
Configure::write('debug', 2);
}
示例13: setUp
function setUp()
{
Router::reload();
$this->Controller = new Controller();
$this->PostsController = new ThemePostsController();
$this->PostsController->viewPath = 'posts';
$this->PostsController->index();
$this->ThemeView = new ThemeView($this->PostsController);
}
示例14: setUp
/**
* Setup
*
* @return void
*/
public function setUp()
{
Configure::write('App.linkMap', array('blogSlug' => array('preset' => array('controller' => 'blog_posts', 'action' => 'view'), 'alias' => 'BlogPost', 'fieldMap' => array('id' => '{alias}.id', 'slug' => '{alias}.slug', 'categorySlug' => 'Category.slug'), 'titleField' => 'BlogPost.title')));
$null = null;
$this->View = new View(null);
$this->View->Helpers->load('Html');
$this->Link = new LinkHelper($this->View);
Router::reload();
Router::connect('/article/:categorySlug/:slug-:id', array('controller' => 'blog_posts', 'action' => 'view'));
}
示例15: startTest
/**
* startTest method
*
* @return void
* @access public
*/
public function startTest()
{
Router::reload();
$this->Controller = new Controller();
$this->View = new View($this->Controller);
$this->Controller->here = $this->View->here = '/';
$this->Controller->params = $this->View->params = array('base' => '/', 'here' => '/', 'webroot' => '/', 'passedArgs' => array(), 'namedArgs' => array());
$this->Menu = new TestMenuHelper();
$this->Menu->Html = new HtmlHelper();
}