/** * 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 = new AppView(); }
/** * Test composer post autoload dump event. * * @return void */ public function testPostAutoloadDump() { Plugin::load('DebugKit'); if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!defined('TMP')) { define('TMP', sys_get_temp_dir() . DS); } $vendorDir = ROOT . 'vendor'; $webRoot = $vendorDir . '/cakephp/debug_kit/webroot'; $assetsDir = $vendorDir . '/cakephp/debug_kit/assets'; if (!is_dir($webRoot) && is_dir($assetsDir)) { $debugWebroot = new Folder($assetsDir); $debugWebroot->copy($webRoot); $debugWebroot->delete($assetsDir); } $composer = new Composer(); /** @var Config $config */ $config = new Config(); $config->merge(['config' => ['vendor-dir' => $vendorDir]]); $composer->setConfig($config); /** @var IOInterface $io */ $io = $this->getMock('Composer\\IO\\IOInterface'); $event = new Event('postAutoloadDump', $composer, $io); Installer::postAutoloadDump($event); Plugin::unload('DebugKit'); }
/** * Setup test data. * * @return void */ public function setUp() { parent::setUp(); $_SERVER['SERVER_NAME'] = 'union.cms'; $_SERVER['SERVER_PORT'] = '80'; Plugin::load('Union/Core', ['path' => ROOT]); }
/** * Setup test data. * * @return void */ public function setUp() { parent::setUp(); $view = new AppView(); $this->Acl = new AclHelper($view); Plugin::load('TestPlugin', ['autoload' => true]); }
/** * 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->Layout = new LayoutHelper($this->View); }
/** * Setup test data. * * @return void */ public function setUp() { parent::setUp(); Plugin::load($this->plugin, ['path' => ROOT, 'autoload' => true, 'bootstrap' => true]); $this->Users = TableRegistry::get('Union/Community.Users'); $this->Roles = TableRegistry::get('Union/Community.Roles'); }
/** * Setup test data. * * @return void */ public function setUp() { parent::setUp(); Plugin::load('TestPlugin'); Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]); $this->View = $this->getMock('Union\\Core\\View\\AppView', ['append']); $this->Url = new UrlHelper($this->View); }
/** * Setup test data. * * @return void */ public function setUp() { parent::setUp(); Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]); Plugin::load('TestPlugin'); Plugin::load('Union/Example'); $this->View = new AppView(); $this->Less = new LessHelper($this->View); }
/** * Setup test data. * * @return void */ public function setUp() { parent::setUp(); $this->session($this->authSession); Plugin::load($this->plugin, ['path' => ROOT, 'autoload' => true, 'bootstrap' => true, 'events' => true, 'routes' => true]); Plugin::load('Union/Extensions', ['autoload' => true, 'bootstrap' => true, 'routes' => true]); Plugin::routes('Union/Extensions'); Plugin::routes($this->plugin); $this->url = ['prefix' => 'admin', 'plugin' => $this->plugin, 'controller' => 'Users', 'action' => 'add']; }
/** * Setup test data. * * @return void */ public function setUp() { parent::setUp(); Plugin::load('TestPlugin'); Plugin::load('Union/Core', ['path' => ROOT]); Router::plugin('TestPlugin', function ($routes) { $routes->fallbacks('DashedRoute'); }); $this->View = new AppView(); $this->Html = new HtmlHelper($this->View); }
/** * Setup data. * * @return void */ public function setUp() { parent::setUp(); Plugin::load('TestPlugin', ['autoload' => true]); }
/** * Setup data. * * @return void */ public function setUp() { parent::setUp(); $this->url = ['prefix' => null, 'plugin' => null, 'controller' => 'Test', 'action' => 'index']; Plugin::load('TestPlugin', ['autoload' => true]); }
/** * Test plugin load by list. * * @return void */ public function testLoadList() { $Folder = new Folder(); $pluginsDir = APP_ROOT . 'Plugins' . DS; $TestPlgPath = $pluginsDir . 'PluginTest'; $Folder->create($TestPlgPath, 0777); new File($TestPlgPath . '/config/bootstrap.php', true); new File($TestPlgPath . '/config/routes.php', true); $NoRoutesPlgPath = $pluginsDir . 'NoRoutes'; $Folder->create($NoRoutesPlgPath, 0777); new File($NoRoutesPlgPath . '/config/bootstrap.php', true); $NoBootstrapPlgPath = $pluginsDir . 'NoBootstrap'; $Folder->create($NoBootstrapPlgPath, 0777); new File($NoBootstrapPlgPath . '/config/routes.php', true); $NoConfigPlgPath = $pluginsDir . 'NoConfig'; $Folder->create($NoConfigPlgPath, 0777); Plugin::load('Migrations'); Plugin::loadList(['NoConfig', 'NoRoutes', 'PluginTest', 'Migrations', 'NoBootstrap']); $this->assertTrue(Plugin::loaded('NoBootstrap')); $this->assertTrue(Plugin::loaded('PluginTest')); $this->assertTrue(Plugin::loaded('NoRoutes')); $this->assertTrue(Plugin::loaded('NoConfig')); // Check virtual paths. $this->assertSame(1, count(vPath()->getPaths('NoBootstrap:'))); $this->assertSame(1, count(vPath()->getPaths('PluginTest:'))); $this->assertSame(1, count(vPath()->getPaths('NoRoutes:'))); $this->assertSame(1, count(vPath()->getPaths('NoConfig:'))); $Folder->delete($TestPlgPath); $Folder->delete($NoRoutesPlgPath); $Folder->delete($NoConfigPlgPath); $Folder->delete($NoBootstrapPlgPath); }
$folder->create(LOGS, 0777); $folder->create(SESSIONS, 0777); $folder->create(CACHE, 0777); $folder->create(CACHE . 'view', 0777); $folder->create(CACHE . 'models', 0777); date_default_timezone_set('UTC'); mb_internal_encoding('UTF-8'); // Include CakePHP framework. /** @noinspection PhpIncludeInspection */ require_once CAKE_CORE_INCLUDE_PATH . '/config/bootstrap.php'; $path = Path::getInstance(); $path->setRoot(ROOT); $path->set('cache', ASSETS_CACHE); // Load union core plugin. Plugin::load('Union/Core', ['routes' => true, 'bootstrap' => true]); Plugin::load('Search'); // Write union test application config. Configure::write('debug', true); Configure::write('App', ['namespace' => 'TestApp', 'encoding' => 'UTF-8', 'base' => false, 'baseUrl' => env('SCRIPT_NAME'), 'dir' => APP_DIR, 'locale' => 'ru_RU', 'fullBaseUrl' => 'http://localhost', 'paths' => ['plugins' => [APP_ROOT . 'Plugins' . DS], 'templates' => [APP . 'Template' . DS, ROOT . '/vendor/union-cms/core/src/Template/'], 'locales' => [APP . 'Locale' . DS]]]); Configure::write('Acl.database', 'test'); Configure::write('Acl.classname', 'DbAcl'); Configure::write('Session', ['defaults' => 'php']); // Write configure for cache model. Cache::config(['_cake_core_' => ['engine' => 'File', 'prefix' => 'cms_core_', 'serialize' => true], '_cake_model_' => ['engine' => 'File', 'prefix' => 'cms_model_', 'serialize' => true]]); Configure::write('EmailTransport', ['default' => ['className' => 'Mail', 'host' => 'localhost', 'port' => 25, 'timeout' => 30, 'username' => 'user', 'password' => 'secret', 'client' => null, 'tls' => null]]); Configure::write('Email', ['default' => ['transport' => 'default', 'from' => 'you@localhost', 'charset' => 'utf-8', 'headerCharset' => 'utf-8']]); // Ensure default test connection is defined. if (!getenv('db_dsn')) { putenv('db_dsn=sqlite:///:memory:'); } ConnectionManager::config('test', ['url' => getenv('db_dsn')]);