Shopware\PluginCreator\Services\Generator::run PHP Метод

run() публичный Метод

Creates the actual plugin from template files
public run ( )
    public function run()
    {
        $this->configureTemplate();
        $path = $this->outputDirectoryProvider->getPath();
        if ($this->ioAdapter->exists($path)) {
            throw new \RuntimeException("Could not create »{$path}«. Directory already exists");
        }
        $this->ioAdapter->createDirectory($path);
        $this->processTemplateFiles();
    }

Usage Example

Пример #1
0
 /**
  * Foreach file provider: Create a plugin which needs this file provider and check,
  * if all required / pre-defined files actually exists.
  */
 public function testPluginGenerator()
 {
     foreach ($this->fileProvider as $name => $provider) {
         $config = $this->getConfigObject();
         $configName = $provider['config'];
         $config->{$configName} = true;
         $config->backendModel = 'Shopware\\CustomModels\\SwagTest\\Test';
         $ioAdapter = new Dummy();
         $generator = new Generator($ioAdapter, $config, new NameGenerator($config), new Template());
         $generator->setOutputDirectory('');
         $generator->run();
         // Test, if the file provider files, do exist
         foreach ($provider['files'] as $file) {
             $this->assertTrue(in_array($file, array_keys($ioAdapter->getFiles())), "{$file} not found in generated files");
         }
         // merge all provider files into one array
         $allProviderFiles = array_reduce(array_column($this->fileProvider, 'files'), function ($a, $b) {
             $a = $a ?: [];
             $b = $b ?: [];
             return array_merge($a, $b);
         });
         // Test, if existing files are defined by a file provider
         foreach (array_keys($ioAdapter->getFiles()) as $file) {
             $this->assertTrue(in_array($file, $allProviderFiles), "{$file} is not defined by any file provider");
         }
     }
 }
All Usage Examples Of Shopware\PluginCreator\Services\Generator::run