当前位置: 首页>>代码示例>>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;未经允许,请勿转载。