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


PHP Router::reload方法代碼示例

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


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

示例1: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Router::reload();
     $View = new View(null);
     $this->Common = new CommonHelper($View);
 }
開發者ID:dereuromark,項目名稱:cakephp-tools,代碼行數:10,代碼來源:CommonHelperTest.php

示例2: testBuildResetWithPlugin

 /**
  * @return void
  */
 public function testBuildResetWithPlugin()
 {
     Router::connect('/:controller/:action/*');
     $result = $this->Url->buildReset(['controller' => 'foobar', 'action' => 'test']);
     $expected = '/foobar/test';
     $this->assertSame($expected, $result);
     $this->Url->request->here = '/admin/foo/bar/baz/test';
     $this->Url->request->params['prefix'] = 'admin';
     $this->Url->request->params['plugin'] = 'Foo';
     Router::reload();
     Router::connect('/:controller/:action/*');
     Router::plugin('Foo', function ($routes) {
         $routes->fallbacks();
     });
     Router::prefix('admin', function ($routes) {
         $routes->plugin('Foo', function ($routes) {
             $routes->fallbacks();
         });
     });
     Plugin::routes();
     Router::pushRequest($this->Url->request);
     $result = $this->Url->build(['controller' => 'bar', 'action' => 'baz', 'x']);
     $expected = '/admin/foo/bar/baz/x';
     $this->assertSame($expected, $result);
     $result = $this->Url->buildReset(['controller' => 'bar', 'action' => 'baz', 'x']);
     $expected = '/bar/baz/x';
     $this->assertSame($expected, $result);
 }
開發者ID:dereuromark,項目名稱:cakephp-tools,代碼行數:31,代碼來源:UrlHelperTest.php

示例3: testQueryStringAndCustomTime

 /**
  * test setting parameters in beforeDispatch method
  *
  * @return void
  */
 public function testQueryStringAndCustomTime()
 {
     $folder = CACHE . 'views' . DS;
     $file = $folder . 'posts-home-coffee-life-sleep-sissies-coffee-life-sleep-sissies.html';
     $content = '<!--cachetime:' . (time() + WEEK) . ';ext:html-->Foo bar';
     file_put_contents($file, $content);
     Router::reload();
     Router::connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
     Router::connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
     Router::connect('/:controller/:action/*');
     $_GET = ['coffee' => 'life', 'sleep' => 'sissies'];
     $filter = new CacheFilter();
     $request = new Request('posts/home/?coffee=life&sleep=sissies');
     $response = new Response();
     $event = new Event(__CLASS__, $this, compact('request', 'response'));
     $filter->beforeDispatch($event);
     $result = $response->body();
     $expected = '<!--created:';
     $this->assertTextStartsWith($expected, $result);
     $expected = '-->Foo bar';
     $this->assertTextEndsWith($expected, $result);
     $result = $response->type();
     $expected = 'text/html';
     $this->assertEquals($expected, $result);
     $result = $response->header();
     $this->assertNotEmpty($result['Expires']);
     // + 1 week
     unlink($file);
 }
開發者ID:jxav,項目名稱:cakephp-cache,代碼行數:34,代碼來源:CacheFilterTest.php

示例4: testResetLink

 /**
  * Tests
  *
  * @return void
  */
 public function testResetLink()
 {
     Router::connect('/:controller/:action/*');
     $result = $this->Html->resetLink('Foo', ['controller' => 'foobar', 'action' => 'test']);
     $expected = '<a href="/foobar/test">Foo</a>';
     $this->assertEquals($expected, $result);
     $this->Html->request->here = '/admin/foobar/test';
     $this->Html->request->params['admin'] = true;
     $this->Html->request->params['prefix'] = 'admin';
     Router::reload();
     Router::connect('/:controller/:action/*');
     Router::prefix('admin', function ($routes) {
         $routes->connect('/:controller/:action/*');
     });
     $result = $this->Html->link('Foo', ['prefix' => 'admin', 'controller' => 'foobar', 'action' => 'test']);
     $expected = '<a href="/admin/foobar/test">Foo</a>';
     $this->assertEquals($expected, $result);
     $result = $this->Html->link('Foo', ['controller' => 'foobar', 'action' => 'test']);
     $expected = '<a href="/admin/foobar/test">Foo</a>';
     //debug($result);
     //$this->assertEquals($expected, $result);
     $result = $this->Html->resetLink('Foo', ['controller' => 'foobar', 'action' => 'test']);
     $expected = '<a href="/foobar/test">Foo</a>';
     $this->assertEquals($expected, $result);
 }
開發者ID:olmprakash,項目名稱:cakephp-tools,代碼行數:30,代碼來源:HtmlHelperTest.php

示例5: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Router::reload();
     Router::connect('/:controller', ['action' => 'index']);
     Router::connect('/:controller/:action/*');
 }
開發者ID:jdaosavanh,項目名稱:clickerwebapp,代碼行數:12,代碼來源:RedirectRouteTest.php

示例6: _loadRoutes

 /**
  * Loads routes and resets if the test case dictates it should
  *
  * @return void
  */
 protected function _loadRoutes()
 {
     parent::_loadRoutes();
     if (!$this->loadRoutes) {
         Router::reload();
     }
 }
開發者ID:ripzappa0924,項目名稱:carte0.0.1,代碼行數:12,代碼來源:ControllerTestCase.php

示例7: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Router::reload();
     $View = new View(null);
     $this->Flash = new FlashHelper($View);
 }
開發者ID:alescx,項目名稱:cakephp-tools,代碼行數:10,代碼來源:FlashHelperTest.php

示例8: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Router::reload();
     $this->View = new View();
     $this->Helper = new Helper($this->View);
     $this->Helper->request = new Request();
 }
開發者ID:Slayug,項目名稱:castor,代碼行數:13,代碼來源:HelperTest.php

示例9: setUp

 public function setUp()
 {
     parent::setUp();
     Router::reload();
     Configure::write('App.namespace', 'Spekkoek\\Test\\TestApp');
     $this->dispatcher = new ActionDispatcher();
     $this->dispatcher->addFilter(new ControllerFactoryFilter());
 }
開發者ID:markstory,項目名稱:cakephp-spekkoek,代碼行數:8,代碼來源:ActionDispatcherTest.php

示例10: setUp

 /**
  * reset environment.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Plugin::load(array('TestPlugin', 'TestPluginTwo'));
     $this->Case = $this->getMockForAbstractClass('Cake\\TestSuite\\ControllerTestCase');
     Router::reload();
     TableRegistry::clear();
 }
開發者ID:ripzappa0924,項目名稱:carte0.0.1,代碼行數:14,代碼來源:ControllerTestCaseTest.php

示例11: setUp

 /**
  * setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Routing.prefixes', []);
     Router::reload();
     $this->Acl = $this->getMockBuilder('Acl\\Controller\\Component\\AclComponent')->disableOriginalConstructor()->getMock();
     $this->Components = $this->getMockBuilder('Cake\\Controller\\ComponentRegistry')->getMock();
     $this->auth = new CrudAuthorize($this->Components);
 }
開發者ID:cakephp,項目名稱:acl,代碼行數:14,代碼來源:CrudAuthorizeTest.php

示例12: setUp

 /**
  * setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Routing.prefixes', array());
     Router::reload();
     $this->Acl = $this->getMock('Acl\\Controller\\Component\\AclComponent', array(), array(), '', false);
     $this->Components = $this->getMock('Cake\\Controller\\ComponentRegistry');
     $this->auth = new CrudAuthorize($this->Components);
 }
開發者ID:ceeram,項目名稱:acl,代碼行數:14,代碼來源:CrudAuthorizeTest.php

示例13: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Router::reload();
     $this->View = new View();
     $this->Helper = new UrlHelper($this->View);
     $this->Helper->request = new Request();
     Configure::write('App.namespace', 'TestApp');
     Plugin::load(['TestTheme']);
 }
開發者ID:Slayug,項目名稱:castor,代碼行數:15,代碼來源:UrlHelperTest.php

示例14: testGetRelationLink

 /**
  * Test initial setup
  *
  * @return void
  */
 public function testGetRelationLink()
 {
     $userId = '481fc6d0-b920-43e0-a40d-6d1740cf8562';
     $articlesId = '99dbcad7-21d5-4dd1-b193-e00543c0224c';
     $article = $this->Articles->newEntity(['title' => 'title', 'content' => 'content']);
     $fieldValue = 123;
     Router::reload();
     $relationLink = $this->Articles->getRelationLink('foobar', $fieldValue);
     $this->assertEquals($fieldValue, $relationLink);
 }
開發者ID:codekanzlei,項目名稱:cake-model-history,代碼行數:15,代碼來源:HistorizableBehaviorTest.php

示例15: setUp

 /**
  * setup create a request object to get out of router later.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Router::reload();
     $request = new Request();
     $request->base = '';
     Router::setRequestInfo($request);
     Configure::write('debug', true);
     $this->_logger = $this->getMock('Psr\\Log\\LoggerInterface');
     Log::reset();
     Log::config('error_test', ['engine' => $this->_logger]);
 }
開發者ID:JesseDarellMoore,項目名稱:CS499,代碼行數:17,代碼來源:ErrorHandlerTest.php


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