fromName() public static method

Initiliaze module from name
public static fromName ( array $moduleName ) : Model
$moduleName array Module name
return Model
Exemplo n.º 1
0
 /**
  * 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();
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * 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();
 }
Exemplo n.º 4
0
 /**
  * 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();
 }
Exemplo n.º 5
0
 /**
  * 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')));
 }