/** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. * * @return void */ public function tearDown() { StaticEventManager::resetInstance(); ModuleModel::uninstall(Registry::get('Application')->getServiceManager()->get('CustomModules')->getModule('Social'), ModuleModel::fromName('Social')); parent::tearDown(); }
/** * Determine if we can create an instance. * * @param string|array $moduleName Module name * @param string $pluginName Plugin name * * @return bool */ public function canCreate($moduleName, $pluginName = null) { if (is_array($moduleName)) { list($moduleName, $pluginName) = $moduleName; } else { $pluginName = $this->toCamelCase($pluginName); } if (isset($this->instances[$moduleName][$pluginName])) { return true; } if (ModuleModel::fromName($moduleName)) { $className = $moduleName . '\\Plugin\\' . $pluginName; if (class_exists($className)) { return true; } } return false; }
/** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. * * @return void */ public function tearDown() { StaticEventManager::resetInstance(); ModuleModel::uninstall(Registry::get('Application')->getServiceManager()->get('CustomModules')->getModule('Blog'), ModuleModel::fromName('Blog')); $this->document->delete(); $this->view->delete(); $this->layout->delete(); $this->documentType->delete(); unset($this->document); unset($this->object); unset($this->view); unset($this->layout); unset($this->documentType); parent::tearDown(); }
/** * Test * * @return void */ public function testInstallActionWithValidPostData() { $this->dispatch('/admin/module/install', 'POST', array('module' => 'Sitemap')); $this->assertResponseStatusCode(302); $this->assertModuleName('GcModule'); $this->assertControllerName('ModuleController'); $this->assertControllerClass('IndexController'); $this->assertMatchedRouteName('module/install'); ModuleModel::fromName('Sitemap')->delete(); }
/** * Test * * @return void */ public function testInstallAndUninstall() { $modules = Registry::get('Application')->getServiceManager()->get('CustomModules'); Model::uninstall($modules->getModule('Blog'), Model::fromName('Blog')); $this->assertInternalType('integer', (int) Model::install($modules, 'Blog')); $this->assertTrue(Model::uninstall($modules->getModule('Blog'), Model::fromName('Blog'))); }