/** * @expectedException October\Rain\Exception\SystemException * @expectedExceptionMessage found */ public function testTemplateNotFound() { $generatedDir = $this->getFixturesDir('temporary/generated'); $this->assertFileNotExists($generatedDir); File::makeDirectory($generatedDir, 0777, true, true); $this->assertFileExists($generatedDir); $structure = ['plugin.php' => 'null.tpl']; $generator = new FilesystemGenerator($generatedDir, $structure); $generator->generate(); }
public function save() { $this->validate(); $modelFilePath = $this->getFilePath(); $namespace = $this->getPluginCodeObj()->toPluginNamespace() . '\\Models'; $structure = [$modelFilePath => 'model.php.tpl']; $variables = ['namespace' => $namespace, 'classname' => $this->className, 'table' => $this->databaseTable]; $generator = new FilesystemGenerator('$', $structure, '$/rainlab/builder/classes/modelmodel/templates'); $generator->setVariables($variables); $generator->generate(); }
protected function initPluginStructure() { $basePath = $this->getPluginPath(); $defaultLanguage = LocalizationModel::getDefaultLanguage(); $structure = [$basePath . '/Plugin.php' => 'plugin.php.tpl', $basePath . '/updates/version.yaml' => 'version.yaml.tpl', $basePath . '/classes', $basePath . '/lang/' . $defaultLanguage . '/lang.php' => 'lang.php.tpl']; $variables = ['authorNamespace' => $this->author_namespace, 'pluginNamespace' => $this->namespace, 'pluginNameSanitized' => $this->sanitizePHPString($this->localizedName), 'pluginDescriptionSanitized' => $this->sanitizePHPString($this->localizedDescription)]; $generator = new FilesystemGenerator('$', $structure, '$/rainlab/builder/classes/pluginbasemodel/templates'); $generator->setVariables($variables); $generator->generate(); }