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


PHP Plugin::load方法代码示例

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


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

示例1: testAddPluginWidgetsFromConfigInConstuctor

 /**
  * Test loading templates files from a plugin
  *
  * @return void
  */
 public function testAddPluginWidgetsFromConfigInConstuctor()
 {
     Plugin::load('TestPlugin');
     $widgets = ['text' => ['Cake\\View\\Widget\\BasicWidget'], 'TestPlugin.test_widgets'];
     $inputs = new WidgetRegistry($this->templates, $this->view, $widgets);
     $this->assertInstanceOf('Cake\\View\\Widget\\LabelWidget', $inputs->get('text'));
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:12,代码来源:WidgetRegistryTest.php

示例2: 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');
     $this->Case->loadRoutes = false;
     DispatcherFactory::add('Routing');
     DispatcherFactory::add('ControllerFactory');
     Router::scope('/', function ($routes) {
         $routes->fallbacks();
     });
     Router::prefix('admin', function ($routes) {
         $routes->plugin('TestPlugin', function ($routes) {
             $routes->fallbacks();
         });
         $routes->fallbacks();
     });
     Router::plugin('TestPlugin', function ($routes) {
         $routes->fallbacks();
     });
     Router::plugin('TestPluginTwo', function ($routes) {
         $routes->fallbacks();
     });
     TableRegistry::clear();
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:31,代码来源:ControllerTestCaseTest.php

示例3: testConfigPlugin

 /**
  * Test config() method with plugin syntax aliases
  *
  * @return void
  */
 public function testConfigPlugin()
 {
     Plugin::load('TestPlugin');
     $data = ['connection' => 'testing', 'entityClass' => 'TestPlugin\\Model\\Entity\\Comment'];
     $result = $this->_locator->config('TestPlugin.TestPluginComments', $data);
     $this->assertEquals($data, $result, 'Returns config data.');
 }
开发者ID:cakedc,项目名称:cakephp-oracle-driver,代码行数:12,代码来源:MethodLocatorTest.php

示例4: setUp

 /**
  * Setup test data.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::load('TestPlugin', ['autoload' => true]);
     Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
     $this->View = $this->getMock('Union\\Core\\View\\AppView', ['append']);
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:12,代码来源:HookTest.php

示例5: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::load('TestPlugin');
     Configure::write('App.namespace', 'TestApp');
     $this->dispatcher = $this->getMockBuilder('Cake\\Console\\ShellDispatcher')->setMethods(['_stop'])->getMock();
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:12,代码来源:ShellDispatcherTest.php

示例6: load

 /**
  * @param $plugins
  * @param $options
  *
  * @throws \makallio85\YamlRoute\Exception\PluginException
  */
 public function load($plugins, $options)
 {
     $routes = isset($options['routes']) && $options['routes'] === true ? true : false;
     $options['routes'] = false;
     CakePlugin::load($plugins, $options);
     if ($routes) {
         if (!is_array($plugins)) {
             $plugins = [$plugins];
         }
         foreach ($plugins as $plugin) {
             if ($this->isLoaded($plugin)) {
                 throw new Exception\PluginException("Plugin {$plugin} is loaded already and should not be loaded twice.");
             }
             $path = Configure::read('plugins')[$plugin] . DS . 'config' . DS . 'routes.yml';
             if (!file_exists($path)) {
                 throw new Exception\PluginException("Yaml route configuration file not found in path {$path}.");
             }
             $route = Yaml::parse(file_get_contents($path));
             $data = ['name' => $plugin, 'route' => $route, 'file' => $path];
             $this->_addLoaded($plugin, $data);
             $data['route'] = $this->_loadRouteConfigs($route);
             Validator::run($data);
             $this->_updateLoaded($plugin, $data);
         }
     }
 }
开发者ID:makallio85,项目名称:yaml-route,代码行数:32,代码来源:Plugin.php

示例7: load

 public static function load($name)
 {
     $path = THREEPLUGINS . $name;
     if (file_exists($path . DS . 'plugin.ini')) {
         $basename = basename($path);
         $config = (new IniReader())->readFile($path . DS . 'plugin.ini')->toArray();
         if (array_key_exists('enabled', $config) && $config['enabled'] === true) {
             if (\Cake\Core\Plugin::loaded('ThreePlugins/' . $basename) === true) {
                 return true;
             }
             if (array_key_exists('depend', $config)) {
                 if (is_array($config['depend'])) {
                     foreach ($config['depend'] as $v) {
                         if (!\Cake\Core\Plugin::loaded($v) && self::load($v) !== true) {
                             throw new MissingDependencyException('Missing dependency ' . $v . ' for plugin ' . $name);
                         }
                     }
                 } else {
                     if (!\Cake\Core\Plugin::loaded($config['depend']) && self::load($config['depend']) !== true) {
                         throw new MissingDependencyException('Missing dependency ' . $config['depend'] . ' for plugin ' . $name);
                     }
                 }
             }
             \Cake\Core\Plugin::load('ThreePlugins/' . $basename, ['autoload' => true, 'bootstrap' => array_key_exists('bootstrap', $config) ? $config['bootstrap'] : false, 'routes' => array_key_exists('routes', $config) ? $config['routes'] : false]);
             $class = '\\ThreePlugins\\' . $basename . '\\' . $basename . 'Plugin';
             if (!class_exists($class)) {
                 throw new FileNotFoundException('Missing class ' . $class . ' into the plugin ' . $name);
             }
             (new $class())->initialize();
             return true;
         }
     }
     return false;
 }
开发者ID:ThreeCMS,项目名称:ThreeCMS,代码行数:34,代码来源:Plugin.php

示例8: setUp

 /**
  * Setup test data.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
     $this->View = new AppView();
     $this->Document = new DocumentHelper($this->View);
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:12,代码来源:DocumentHelperTest.php

示例9: testMainWithPlugin

 /**
  * Test the main with plugin.name method.
  *
  * @return void
  */
 public function testMainWithPlugin()
 {
     Plugin::load('SimpleBakeTest', ['path' => APP . 'Plugin' . DS . 'SimpleBakeTest' . DS]);
     $filename = $this->_normalizePath(APP . 'Plugin/SimpleBakeTest/src/Model/Behavior/ExampleBehavior.php');
     $this->Task->expects($this->once())->method('createFile')->with($filename, $this->stringContains('class ExampleBehavior extends Behavior'));
     $this->Task->Test->expects($this->once())->method('bake')->with('behavior', 'Example');
     $this->Task->main('SimpleBakeTest.Example');
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:13,代码来源:SimpleBakeTaskTest.php

示例10: setUp

 /**
  * Setup test data.
  *
  * @return void
  */
 public function setUp()
 {
     Plugin::load('TestPlugin', ['autoload' => true]);
     Router::plugin('TestPlugin', function ($routes) {
         $routes->fallbacks('DashedRoute');
     });
     Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:13,代码来源:AppViewIntegrationTest.php

示例11: setUp

 /**
  * Setup test data.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
     $padding = ['Pages' => ['page' => 1, 'current' => 4, 'count' => 4, 'perPage' => 30, 'limit' => null, 'finder' => 'all', 'prevPage' => false, 'nextPage' => false, 'pageCount' => false, 'directionDefault' => 'DESC', 'direction' => 'DESC', 'sort' => 'Pages.id', 'sortDefault' => 'Pages.id']];
     $this->ViewAdmin = new AppView(new Request(['params' => ['pass' => [], 'prefix' => 'admin', 'paging' => $padding]]));
     $this->View = new AppView(new Request(['params' => ['pass' => [], 'paging' => $padding]]));
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:13,代码来源:PaginatorHelperTest.php

示例12: setUp

 /**
  * Setup test data.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
     $this->View = $this->getMock('Union\\Core\\View\\AppView', ['append']);
     $this->Nav = new NavHelper($this->View);
     Nav::add('test_menu', 'dashboard', ['title' => __d('union', 'Dashboard'), 'weight' => 0, 'icon' => 'dashboard', 'url' => 'link', 'children' => ['link-1' => ['title' => __d('union', 'Children 1'), 'weight' => 0, 'url' => 'link-2']]]);
     Nav::add('test_menu_2', 'dashboard', ['title' => __d('union', 'Dashboard'), 'weight' => 0, 'class' => 'customClass', 'liClass' => 'customLiClass', 'icon' => 'dashboard', 'url' => 'link', 'children' => ['link-1' => ['title' => __d('union', 'Children 1'), 'weight' => 0, 'url' => 'link-2']]]);
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:14,代码来源:NavHelperTest.php

示例13: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::load(['TestPlugin', 'TestPluginTwo']);
     $this->out = new TestStringOutput();
     $io = new ConsoleIo($this->out);
     $this->Shell = $this->getMock('Cake\\Shell\\CommandListShell', ['in', 'err', '_stop', 'clear'], [$io]);
     $this->Shell->Command = $this->getMock('Cake\\Shell\\Task\\CommandTask', ['in', '_stop', 'err', 'clear'], [$io]);
 }
开发者ID:neilan35,项目名称:betterwindow1,代码行数:14,代码来源:CommandListShellTest.php

示例14: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::load(['TestPlugin', 'TestPluginTwo']);
     $this->out = new ConsoleOutput();
     $io = new ConsoleIo($this->out);
     $this->Shell = $this->getMockBuilder('Cake\\Shell\\CommandListShell')->setMethods(['in', 'err', '_stop', 'clear'])->setConstructorArgs([$io])->getMock();
     $this->Shell->Command = $this->getMockBuilder('Cake\\Shell\\Task\\CommandTask')->setMethods(['in', '_stop', 'err', 'clear'])->setConstructorArgs([$io])->getMock();
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:14,代码来源:CommandListShellTest.php

示例15: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Plugin::load(['TestPlugin', 'TestTheme']);
     $request = $this->getMock('Cake\\Network\\Request');
     $response = $this->getMock('Cake\\Network\\Response');
     $this->View = new \Cake\View\View($request, $response);
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:14,代码来源:CellTest.php


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