public function testCallAddBuilderBeforeSetVariables() { $builder = new DemoBuilder(); $generator = new Generator(); $generator->addBuilder($builder); $generator->setVariables(array('foo' => 'bar')); $this->assertNull($builder->getVariable('foo'), ' If addBuilder is called before setVariables then common builder variables will be skipped'); }
/** * Strategy based on the ".travis.yml" file * * @return TravisCiBuildStrategy */ public function getTravisCiStrategy() { $builder = new DockerfileBuilder(); $generator = new Generator(); $generator->setTemplateDirs(array(__DIR__ . "/../../../resources/templates")); $generator->setMustOverwriteIfExists(true); $generator->addBuilder($builder); return new TravisCiBuildStrategy($builder, $this->getBuildPath(), $this->getNaming(), $this->getFilesystem()); }
/** * Add a builder * @param BuilderInterface $builder */ public function addBuilder(BuilderInterface $builder) { parent::addBuilder($builder); $vars = array_replace_recursive($this->getFromYaml('params', array()), $this->getFromYaml(sprintf('builders.%s.params', $builder->getYamlKey()), array())); $builder->setVariables($vars); $builder->setColumnClass($this->getColumnClass()); }
/** * Add a builder * @param BuilderInterface $builder * * @return void */ public function addBuilder(BuilderInterface $builder) { parent::addBuilder($builder); $params = $this->getFromYaml('params', array()); $params = $this->applyActionsBuilderDefaults($params); $params = $this->mergeParameters($params, $this->getFromYaml(sprintf('builders.%s.params', $builder->getYamlKey()), array())); $builder->setVariables($params); $builder->setColumnClass($this->getColumnClass()); }