/** * @return void */ protected function _clearCache() { $path = vPath()->get('cache:'); $folder = new Folder($path); $folder->delete(); }
/** * Test not exit plugin asset. * * @return void */ public function testAssetTimestamp() { Configure::write('debug', true); Configure::write('Asset.timestamp', true); $path = vPath()->get('TestPlugin:assets/css/import.css'); $path = $this->Url->assetTimestamp($path); $this->assertRegExp('/.*css\\/import\\.css\\?[0-9]+/', $path); $path = $this->Url->assetTimestamp('TestPlugin:assets/css/import.css'); $this->assertRegExp('/.*css\\/import\\.css\\?[0-9]+/', $path); Configure::write('Asset.timestamp', false); }
/** * 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); }
/** * Initialization hook method. * * @return void */ public function initialize() { $this->_path = vPath(); Hook::applyHelpers($this); }