示例#1
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     Cache::delete('object_map', '_cake_core_');
     App::build();
     CakePlugin::unload();
 }
示例#2
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     $_SESSION = array();
     unset($this->View, $this->Session);
     CakePlugin::unload();
     parent::tearDown();
 }
示例#3
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Task);
     $Folder = new Folder($this->path);
     $Folder->delete();
     CakePlugin::unload();
 }
示例#4
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     require App::pluginPath('Lil') . DS . 'Config' . DS . 'core.php';
     CakePlugin::unload('LilInvoices');
     CakePlugin::unload('LilTravelOrders');
     $this->Expense = ClassRegistry::init('LilExpenses.Expense');
 }
示例#5
0
 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $appDir = CakePlugin::path('Croogo') . 'Test' . DS . 'test_app' . DS;
     App::build(array('Plugin' => array($appDir . 'Plugin' . DS), 'View' => array($appDir . 'View' . DS)), App::PREPEND);
     $this->_paths = App::paths();
     CakePlugin::unload('Install');
     CakePlugin::load('Example');
     Configure::write('Acl.database', 'test');
     $this->setupSettings($appDir);
 }
示例#6
0
 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('Plugin' => array(TESTS . 'test_app' . DS . 'Plugin' . DS), 'View' => array(TESTS . 'test_app' . DS . 'View' . DS)), App::PREPEND);
     CakePlugin::unload('Install');
     CakePlugin::load('Example');
     Configure::write('Acl.database', 'test');
     $Setting = ClassRegistry::init('Setting');
     $Setting->settingsPath = TESTS . 'test_app' . DS . 'Config' . DS . 'settings.yml';
     $Setting->writeConfiguration();
 }
 /**
  * end a test
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Helper);
     Cache::delete(AssetConfig::CACHE_BUILD_TIME_KEY, AssetConfig::CACHE_CONFIG);
     Cache::drop(AssetConfig::CACHE_CONFIG);
     // @codingStandardsIgnoreStart
     @unlink(TMP . AssetConfig::BUILD_TIME_FILE);
     // @codingStandardsIgnoreEnd
     CakePlugin::unload('TestAssetIni');
 }
示例#8
0
 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('Plugin' => array(TESTS . 'test_app' . DS . 'Plugin' . DS), 'View' => array(TESTS . 'test_app' . DS . 'View' . DS)), App::PREPEND);
     CakePlugin::unload('Install');
     CakePlugin::load('Example');
     Configure::write('Acl.database', 'test');
     $Setting = ClassRegistry::init('Settings.Setting');
     $Setting->settingsPath = TESTS . 'test_app' . DS . 'Config' . DS . 'settings.json';
     Configure::drop('settings');
     Configure::config('settings', new CroogoJsonReader(dirname($Setting->settingsPath) . DS));
     $Setting->writeConfiguration();
 }
示例#9
0
 /**
  * Tests unloading plugins
  *
  * @return void
  */
 public function testUnload()
 {
     CakePlugin::load('TestPlugin');
     $expected = array('TestPlugin');
     $this->assertEquals($expected, CakePlugin::loaded());
     CakePlugin::unload('TestPlugin');
     $this->assertEquals(array(), CakePlugin::loaded());
     CakePlugin::load('TestPlugin');
     $expected = array('TestPlugin');
     $this->assertEquals($expected, CakePlugin::loaded());
     CakePlugin::unload('TestFakePlugin');
     $this->assertEquals($expected, CakePlugin::loaded());
 }
 /**
  * test importing loggers from app/libs and plugins.
  *
  * @return void
  */
 public function testImportingLoggers()
 {
     App::build(array('Lib' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Lib' . DS), 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), App::RESET);
     CakePlugin::load('TestPlugin');
     $result = CakeLog::config('libtest', array('engine' => 'TestAppLog'));
     $this->assertTrue($result);
     $this->assertEquals(CakeLog::configured(), array('libtest'));
     $result = CakeLog::config('plugintest', array('engine' => 'TestPlugin.TestPluginLog'));
     $this->assertTrue($result);
     $this->assertEquals(CakeLog::configured(), array('libtest', 'plugintest'));
     App::build();
     CakePlugin::unload();
 }
示例#11
0
 /**
  * Compile assets for admin ui
  */
 public function make()
 {
     App::uses('AssetGenerator', 'Install.Lib');
     if (!CakePlugin::loaded('Install')) {
         CakePlugin::load('Install');
     }
     $generator = new AssetGenerator();
     try {
         $generator->generate(array('clone' => true));
     } catch (Exception $e) {
         $this->err('<error>' . $e->getMessage() . '</error>');
     }
     CakePlugin::unload('Install');
 }
 /**
  * Before migration callback
  *
  * @param string $direction, up or down direction of migration process
  * @return boolean Should process continue
  * @access public
  */
 public function before($direction)
 {
     $success = true;
     if ($direction === 'up') {
         if (Configure::read('Croogo.installed')) {
             CakePlugin::load('Install');
             $dm = new DataMigration();
             $dir = CakePlugin::path('Install') . 'Config' . DS . 'Data' . DS;
             $dm->loadFile($dir . 'SettingData.php', array('extract' => sprintf('{n}[key=%s]', $this->_assetTimestamp)));
             CakePlugin::unload('Install');
         }
     } else {
         $Setting = ClassRegistry::init('Settings.Setting');
         $success = $Setting->deleteKey($this->_assetTimestamp);
     }
     return $success;
 }
示例#13
0
 public function testConstructor()
 {
     $plugins = CakePlugin::loaded();
     $plugins = array_filter(CakePlugin::loaded(), function ($plugin) {
         return 'Common' != $plugin && is_null(CakePlugin::unload($plugin));
     });
     $this->Model->getEventManager()->flush();
     ClassRegistry::flush();
     CakePlugin::load('TestExample');
     $Model = ClassRegistry::init('TestCommonAppModel');
     $result = $Model->actsAs;
     $expected = array('TestExample.TestExample' => null);
     $this->assertEqual($result, $expected);
     array_walk($plugins, function ($plugin) {
         CakePlugin::load($plugin);
     });
 }
 /**
  * Before migration callback
  *
  * @param string $direction, up or down direction of migration process
  * @return boolean Should process continue
  * @access public
  */
 public function before($direction)
 {
     $success = true;
     if ($direction === 'up') {
         if (Configure::read('Croogo.installed')) {
             $settingsToUpdate = array('Site.locale', 'Site.admin_theme', 'Site.home_url');
             CakePlugin::load('Install');
             $dm = new DataMigration();
             $dir = CakePlugin::path('Install') . 'Config' . DS . 'Data' . DS;
             foreach ($settingsToUpdate as $key) {
                 $dm->loadFile($dir . 'SettingData.php', array('extract' => sprintf('{n}[key=%s]', $key)));
             }
             CakePlugin::unload('Install');
         }
     }
     return $success;
 }
 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('Plugin' => array(TESTS . 'test_app' . DS . 'Plugin' . DS), 'View' => array(TESTS . 'test_app' . DS . 'View' . DS)), App::PREPEND);
     if (!isset($_SERVER['REMOTE_ADDR'])) {
         $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     }
     CakePlugin::unload('Install');
     CakePlugin::load(array('Users'), array('bootstrap' => true));
     CakePlugin::load('Example');
     Configure::write('Acl.database', 'test');
     $Setting = ClassRegistry::init('Settings.Setting');
     $Setting->settingsPath = TESTS . 'test_app' . DS . 'Config' . DS . 'settings.json';
     Configure::drop('settings');
     Configure::config('settings', new CroogoJsonReader(dirname($Setting->settingsPath) . DS));
     CakeLog::drop('stdout');
     CakeLog::drop('stderr');
     $Setting->writeConfiguration();
 }
示例#16
0
 public function testConstructedClasses()
 {
     $plugins = array_filter(CakePlugin::loaded(), function ($plugin) {
         return 'Common' != $plugin && is_null(CakePlugin::unload($plugin));
     });
     $this->Controller->eventManager->flush();
     CakePlugin::load('TestExample');
     $Controller = new TestCommonAppController(new CakeRequest(), new CakeResponse());
     $Controller->Components = $this->getMock('ComponentCollection', array('init'));
     $Controller->eventManager = new CommonEventManager();
     $Controller->constructClasses();
     $result = $Controller->components;
     $expected = array('Email' => array('from' => '*****@*****.**'), 'Session' => null, 'TestExample.TestExample' => null);
     $this->assertEqual($result, $expected);
     $result = $Controller->helpers;
     $expected = array('Number' => null, 'TestExample.TestExample' => null, 'Common.Navigation' => null);
     $this->assertEqual($result, $expected);
     array_walk($plugins, function ($plugin) {
         CakePlugin::load($plugin);
     });
 }
示例#17
0
 public function setUp()
 {
     parent::setUp();
     if (empty($_GET['bootstrap'])) {
         $this->__resetPlugins = array();
         foreach (array('TwitterBootstrap', 'BoostCake') as $plugin) {
             if (CakePlugin::loaded($plugin)) {
                 $resetPlugins[] = $plugin;
                 CakePlugin::unload($plugin);
             }
         }
     }
     $this->View = $this->getMock('View', array('append'), array(new TableHelperTestController()));
     $this->Table = new TestTableHelper($this->View);
     $this->Table->Paginator = new PaginatorHelper($this->View);
     if (CakePlugin::loaded('TwitterBootstrap')) {
         App::uses('BootstrapPaginatorHelper', 'TwitterBootstrap.View/Helper');
         $this->Table->Paginator = new BootstrapPaginatorHelper($this->View);
     }
     $this->Table->Paginator->request = new CakeRequest(null, false);
     $this->Table->Paginator->request->addParams(array('paging' => array('Article' => array('page' => 1, 'current' => 2, 'count' => 8, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 3, 'order' => null, 'limit' => 3, 'options' => array('page' => 1, 'conditions' => array()), 'paramType' => 'named'))));
 }
 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Shell);
     CakePlugin::unload();
 }
示例#19
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     $_GET = $this->_get;
     $_POST = $this->_post;
     $_FILES = $this->_files;
     $_SERVER = $this->_server;
     App::build();
     CakePlugin::unload();
     Configure::write('App', $this->_app);
     Configure::write('Cache', $this->_cache);
     Configure::write('debug', $this->_debug);
     Configure::write('Dispatcher.filters', array());
 }
示例#20
0
 /**
  * testPluginAppModel method
  *
  * @return void
  */
 public function testPluginAppModel()
 {
     $TestRegistryPluginModel = ClassRegistry::isKeySet('TestRegistryPluginModel');
     $this->assertFalse($TestRegistryPluginModel);
     //Faking a plugin
     CakePlugin::load('RegistryPlugin', array('path' => '/fake/path'));
     $TestRegistryPluginModel = ClassRegistry::init('RegistryPlugin.TestRegistryPluginModel');
     $this->assertTrue(is_a($TestRegistryPluginModel, 'TestRegistryPluginModel'));
     $this->assertEquals($TestRegistryPluginModel->tablePrefix, 'something_');
     $PluginUser = ClassRegistry::init(array('class' => 'RegistryPlugin.RegisterUser', 'alias' => 'RegistryPluginUser', 'table' => false));
     $this->assertTrue(is_a($PluginUser, 'RegistryPluginAppModel'));
     $PluginUserCopy = ClassRegistry::getObject('RegistryPluginUser');
     $this->assertTrue(is_a($PluginUserCopy, 'RegistryPluginAppModel'));
     $this->assertSame($PluginUser, $PluginUserCopy);
     CakePlugin::unload();
 }
 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     CakePlugin::unload();
     unset($this->Coverage);
     parent::tearDown();
 }
示例#22
0
 /**
  * test that using Plugin.name with write.
  *
  * @return void
  */
 public function testPluginDotSyntaxWithCreate()
 {
     App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)));
     CakePlugin::load('TestPlugin');
     $this->Shell->params = array('connection' => 'test');
     $this->Shell->args = array('TestPlugin.TestPluginApp');
     $this->Shell->startup();
     $this->Shell->expects($this->any())->method('in')->will($this->returnValue('y'));
     $this->Shell->create();
     $db = ConnectionManager::getDataSource('test');
     $sources = $db->listSources();
     $this->assertTrue(in_array($db->config['prefix'] . 'test_plugin_acos', $sources));
     $schema = new TestPluginAppSchema();
     $db->execute($db->dropSchema($schema, 'test_plugin_acos'));
     CakePlugin::unload();
 }
示例#23
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     CakePlugin::unload();
 }
示例#24
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     CakePlugin::unload();
     unset($this->View);
     unset($this->PostsController);
     unset($this->Controller);
     unset($this->ThemeView);
     unset($this->ThemePostsController);
     unset($this->ThemeController);
 }
 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     CakePlugin::unload();
     unset($this->Helpers, $this->View);
     parent::tearDown();
 }
 /**
  * Test assetUrl with plugins.
  *
  * @return void
  */
 public function testAssetUrlPlugin()
 {
     $this->Helper->webroot = '';
     CakePlugin::load('TestPlugin');
     $result = $this->Helper->assetUrl('TestPlugin.style', array('ext' => '.css'));
     $this->assertEquals('test_plugin/style.css', $result);
     $result = $this->Helper->assetUrl('TestPlugin.style', array('ext' => '.css', 'plugin' => false));
     $this->assertEquals('TestPlugin.style.css', $result);
     CakePlugin::unload('TestPlugin');
 }
示例#27
0
 /**
  * test bake() with a -plugin param
  *
  * @return void
  */
 public function testBakeWithPlugin()
 {
     $this->Task->plugin = 'TestTest';
     //fake plugin path
     CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS));
     $path = APP . 'Plugin' . DS . 'TestTest' . DS . 'Test' . DS . 'Case' . DS . 'View' . DS . 'Helper' . DS . 'FormHelperTest.php';
     $this->Task->expects($this->once())->method('createFile')->with($path, $this->anything());
     $this->Task->bake('Helper', 'Form');
     CakePlugin::unload();
 }
示例#28
0
 /**
  * Test reading from plugins.
  *
  * @return void
  */
 public function testReadPluginValue()
 {
     App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), App::RESET);
     CakePlugin::load('TestPlugin');
     $reader = new PhpReader($this->path);
     $result = $reader->read('TestPlugin.load');
     $this->assertTrue(isset($result['plugin_load']));
     $result = $reader->read('TestPlugin.load.php');
     $this->assertTrue(isset($result['plugin_load']));
     CakePlugin::unload();
 }
示例#29
0
 /**
  * Tests that a model can be loaded from the model names passed in the request object
  *
  * @return void
  */
 public function testIntrospectModelFromRequest()
 {
     $this->loadFixtures('Post');
     App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)));
     CakePlugin::load('TestPlugin');
     $this->Form->request['models'] = array('TestPluginPost' => array('plugin' => 'TestPlugin', 'className' => 'TestPluginPost'));
     $this->assertFalse(ClassRegistry::isKeySet('TestPluginPost'));
     $this->Form->create('TestPluginPost');
     $this->assertTrue(ClassRegistry::isKeySet('TestPluginPost'));
     $this->assertInstanceOf('TestPluginPost', ClassRegistry::getObject('TestPluginPost'));
     CakePlugin::unload();
     App::build();
 }
 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     CakePlugin::unload();
     $this->Case->controller = null;
 }