当前位置: 首页>>代码示例>>PHP>>正文


PHP Plugin::routes方法代码示例

本文整理汇总了PHP中Cake\Core\Plugin::routes方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::routes方法的具体用法?PHP Plugin::routes怎么用?PHP Plugin::routes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Core\Plugin的用法示例。


在下文中一共展示了Plugin::routes方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::routes('CakeDC/Users');
     $this->View = $this->getMock('Cake\\View\\View', ['append']);
     $this->User = new UserHelper($this->View);
     $this->request = new Request();
 }
开发者ID:drmonkeyninja,项目名称:users,代码行数:13,代码来源:UserHelperTest.php

示例3: setUp

 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     $this->traitClassName = 'CakeDC\\Users\\Controller\\Traits\\RegisterTrait';
     $this->traitMockMethods = ['validate', 'dispatchEvent', 'set', 'validateReCaptcha', 'redirect'];
     $this->mockDefaultEmail = true;
     parent::setUp();
     Plugin::routes('CakeDC/Users');
 }
开发者ID:OrigamiStructures,项目名称:users,代码行数:13,代码来源:RegisterTraitTest.php

示例4: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->Users = TableRegistry::get('CakeDC/Users.Users');
     $this->fullBaseBackup = Router::fullBaseUrl();
     Router::fullBaseUrl('http://users.test');
     Email::configTransport('test', ['className' => 'Debug']);
     $this->configEmail = Email::config('default');
     Email::config('default', ['transport' => 'test', 'from' => 'cakedc@example.com']);
     $this->Email = new Email(['from' => 'test@example.com', 'transport' => 'test']);
     Plugin::routes('CakeDC/Users');
 }
开发者ID:drmonkeyninja,项目名称:users,代码行数:17,代码来源:UsersTableTest.php

示例5: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::routes('CakeDC/Users');
     $this->View = $this->getMockBuilder('Cake\\View\\View')->setMethods(['append'])->getMock();
     //Assuming all these url's are authorized
     $this->AuthLink = $this->getMockBuilder('CakeDC\\Users\\View\\Helper\\AuthLinkHelper')->setMethods(['isAuthorized'])->setConstructorArgs([$this->View])->getMock();
     $this->AuthLink->expects($this->any())->method('isAuthorized')->will($this->returnValue(true));
     $this->User = new UserHelper($this->View);
     $this->User->AuthLink = $this->AuthLink;
     $this->request = new Request();
 }
开发者ID:cakedc,项目名称:users,代码行数:17,代码来源:UserHelperTest.php

示例6: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->backupUsersConfig = Configure::read('Users');
     Router::reload();
     Plugin::routes('CakeDC/Users');
     Router::connect('/route/*', ['plugin' => 'CakeDC/Users', 'controller' => 'Users', 'action' => 'requestResetPassword']);
     Security::salt('YJfIxfs2guVoUubWDYhG93b0qyJfIxfs2guwvniR2G0FgaC9mi');
     Configure::write('App.namespace', 'Users');
     $this->request = $this->getMock('Cake\\Network\\Request', ['is', 'method']);
     $this->request->expects($this->any())->method('is')->will($this->returnValue(true));
     $this->response = $this->getMock('Cake\\Network\\Response', ['stop']);
     $this->Controller = new Controller($this->request, $this->response);
     $this->Registry = $this->Controller->components();
     $this->Controller->UsersAuth = new UsersAuthComponent($this->Registry);
 }
开发者ID:GF-TIC,项目名称:users,代码行数:21,代码来源:UsersAuthComponentTest.php

示例7:

    $routes->connect('/admin/edit/*', ['controller' => 'Users', 'action' => 'adminEdit']);
    $routes->connect('/tickets/add/*', ['controller' => 'Tickets', 'action' => 'add']);
    $routes->connect('/tickets/delete/*', ['controller' => 'Tickets', 'action' => 'delete']);
    /**
     * ...and connect the rest of 'Pages' controller's URLs.
     */
    $routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
    /**
     * Connect catchall routes for all controllers.
     *
     * Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for
     *    `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);`
     *    `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);`
     *
     * Any route class can be used with this method, such as:
     * - DashedRoute
     * - InflectedRoute
     * - Route
     * - Or your own route class
     *
     * You can remove these routes once you've connected the
     * routes you want in your application.
     */
    $routes->fallbacks('DashedRoute');
});
/**
 * Load all plugin routes.  See the Plugin documentation on
 * how to customize the loading of plugin routes.
 */
Plugin::routes();
开发者ID:Custodia,项目名称:caketickets,代码行数:30,代码来源:routes.php

示例8: testLoadAllWithDefaultsAndOverride

 /**
  * Tests that Plugin::loadAll() will load all plgins in the configured folder wit defaults
  * and overrides for a plugin
  *
  * @return void
  */
 public function testLoadAllWithDefaultsAndOverride()
 {
     Plugin::loadAll(array(array('bootstrap' => true, 'ignoreMissing' => true), 'TestPlugin' => array('routes' => true)));
     Plugin::routes();
     $expected = ['Company', 'PluginJs', 'TestPlugin', 'TestPluginTwo'];
     $this->assertEquals($expected, Plugin::loaded());
     $this->assertEquals('loaded js plugin bootstrap', Configure::read('PluginTest.js_plugin.bootstrap'));
     $this->assertEquals('loaded plugin routes', Configure::read('PluginTest.test_plugin.routes'));
     $this->assertEquals(null, Configure::read('PluginTest.test_plugin.bootstrap'));
     $this->assertEquals('loaded plugin two bootstrap', Configure::read('PluginTest.test_plugin_two.bootstrap'));
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:17,代码来源:PluginTest.php

示例9: testUpdateWithPlugins

 /**
  * Ensures that nested plugins are correctly created
  *
  * @return void
  */
 public function testUpdateWithPlugins()
 {
     Plugin::unload();
     Plugin::load('TestPlugin', ['routes' => true]);
     Plugin::load('Nested/TestPluginTwo');
     Plugin::routes();
     $this->_clean();
     $this->Task->expects($this->atLeast(3))->method('getControllerList')->will($this->returnCallback(function ($plugin, $prefix) {
         switch ($plugin) {
             case 'TestPlugin':
                 return ['PluginController.php'];
             case 'Nested/TestPluginTwo':
                 if ($prefix !== null) {
                     return [];
                 }
                 return ['PluginTwoController.php'];
             default:
                 if ($prefix !== null) {
                     return ['PostsController.php', 'BigLongNamesController.php'];
                 }
                 return ['CommentsController.php', 'PostsController.php', 'BigLongNamesController.php'];
         }
     }));
     $this->Task->startup();
     $this->Task->acoUpdate();
     $Aco = $this->Task->Acl->Aco;
     $result = $Aco->node('controllers/TestPlugin/Plugin');
     $this->assertNotFalse($result);
     $this->assertEquals($result->toArray()[0]['alias'], 'Plugin');
     $result = $Aco->node('controllers/TestPlugin/Admin/Plugin');
     $this->assertNotFalse($result);
     $this->assertEquals($result->toArray()[0]['alias'], 'Plugin');
     $result = $Aco->node('controllers/Nested\\TestPluginTwo/PluginTwo');
     $this->assertNotFalse($result);
     $result = $result->toArray();
     $this->assertEquals($result[0]['alias'], 'PluginTwo');
     $result = $Aco->find('children', ['for' => $result[0]['id']])->toArray();
     $this->assertEquals(count($result), 3);
     $this->assertEquals($result[0]['alias'], 'index');
     $this->assertEquals($result[1]['alias'], 'add');
     $this->assertEquals($result[2]['alias'], 'edit');
 }
开发者ID:edukondaluetg,项目名称:acl,代码行数:47,代码来源:AclExtrasTest.php

示例10: _pluginRoutes

 /**
  * Run Plugin::routes()
  */
 private static function _pluginRoutes()
 {
     if (!self::_isExecuted('\\Cake\\Core\\Plugin::routes()')) {
         CakePlugin::routes();
         self::setExecuted('\\Cake\\Core\\Plugin::routes()');
         // Debugging
         if (self::$_debug) {
             self::_addToDump('\\Cake\\Core\\Plugin::routes();' . "\n");
         }
     }
 }
开发者ID:josegonzalez,项目名称:cake-yaml,代码行数:14,代码来源:Generator.php

示例11: DebugBarFilter

 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Datasource\ConnectionManager;
use Cake\Event\EventManager;
use Cake\Log\Log;
use Cake\Routing\DispatcherFactory;
use DebugKit\Routing\Filter\DebugBarFilter;
$debugBar = new DebugBarFilter(EventManager::instance(), (array) Configure::read('DebugKit'));
if (!$debugBar->isEnabled() || php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg') {
    return;
}
$hasDebugKitConfig = ConnectionManager::config('debug_kit');
if (!$hasDebugKitConfig && !in_array('sqlite', PDO::getAvailableDrivers())) {
    $msg = 'DebugKit not enabled. You need to either install pdo_sqlite, ' . 'or define the "debug_kit" connection name.';
    Log::warning($msg);
    return;
}
if (!$hasDebugKitConfig) {
    ConnectionManager::config('debug_kit', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Sqlite', 'database' => TMP . 'debug_kit.sqlite', 'encoding' => 'utf8', 'cacheMetadata' => true, 'quoteIdentifiers' => false]);
}
if (Plugin::routes('DebugKit') === false) {
    require __DIR__ . DS . 'routes.php';
}
// Setup toolbar
$debugBar->setup();
DispatcherFactory::add($debugBar);
开发者ID:cakephp,项目名称:debug_kit,代码行数:31,代码来源:bootstrap.php

示例12: _pluginRoutes

 /**
  * Run Plugin::routes()
  */
 private function _pluginRoutes()
 {
     if (!self::_isExecuted('\\Cake\\Core\\Plugin::routes()')) {
         CakePlugin::routes();
         $this->_setExecuted('\\Cake\\Core\\Plugin::routes()');
         // Debugging
         if ($this->_debug) {
             $this->_addToDump('\\Cake\\Core\\Plugin::routes();' . "\n");
         }
     }
 }
开发者ID:makallio85,项目名称:yaml-route,代码行数:14,代码来源:Generator.php

示例13: testLoadAllWithDefaultsAndOverride

 /**
  * Tests that Plugin::loadAll() will load all plugins in the configured folder wit defaults
  * and overrides for a plugin
  *
  * @return void
  */
 public function testLoadAllWithDefaultsAndOverride()
 {
     Plugin::loadAll([['bootstrap' => true, 'ignoreMissing' => true], 'TestPlugin' => ['routes' => true], 'TestPluginFour' => ['bootstrap' => true, 'classBase' => '']]);
     Plugin::routes();
     $expected = ['Company', 'PluginJs', 'TestPlugin', 'TestPluginFour', 'TestPluginTwo', 'TestTheme'];
     $this->assertEquals($expected, Plugin::loaded());
     $this->assertEquals('loaded js plugin bootstrap', Configure::read('PluginTest.js_plugin.bootstrap'));
     $this->assertEquals('loaded plugin routes', Configure::read('PluginTest.test_plugin.routes'));
     $this->assertEquals(null, Configure::read('PluginTest.test_plugin.bootstrap'));
     $this->assertEquals('loaded plugin two bootstrap', Configure::read('PluginTest.test_plugin_two.bootstrap'));
     $this->assertEquals('loaded plugin four bootstrap', Configure::read('PluginTest.test_plugin_four.bootstrap'));
     // TestPluginThree won't get loaded by loadAll() since it's in a sub directory.
     $this->assertEquals(null, Configure::read('PluginTest.test_plugin_three.bootstrap'));
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:20,代码来源:PluginTest.php


注:本文中的Cake\Core\Plugin::routes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。