public function testModuleGenerator()
 {
     $generator = new ModuleGenerator();
     $generator->template = 'default';
     $generator->moduleID = 'test';
     $generator->moduleClass = 'app\\modules\\test\\Module';
     $valid = $generator->validate();
     $this->assertTrue($valid, 'Validation failed: ' . print_r($generator->getErrors(), true));
     $this->assertNotEmpty($generator->generate());
 }
Пример #2
0
 public function testModuleGenerator()
 {
     $generator = new ModuleGenerator();
     $generator->template = 'default';
     $generator->moduleID = 'test';
     $generator->moduleClass = 'app\\modules\\test\\Module';
     if ($generator->validate()) {
         $generator->generate();
     } else {
         print_r($generator->getErrors());
     }
 }
Пример #3
0
 public function actionCreateModule($id)
 {
     /**
      * @var CodeFile $code
      */
     $generator = new Generator();
     $generator->moduleID = $id;
     $generator->moduleClass = 'app\\modules\\' . strtolower($id) . '\\' . ucfirst($id) . "Module";
     foreach ($generator->generate() as $code) {
         $code->save();
     }
     $this->stdout("Module '{$id}' generated\n");
     $this->stdout("Add to modules: '{$id}' => '{$generator->moduleClass}'\ns");
 }