Ejemplo n.º 1
0
 protected function configureView()
 {
     $thisConsoleCommand = $this->getExecutedConsoleCommandForTravis();
     $this->view->setGenerateYmlCommand($thisConsoleCommand);
     $phpVersions = @$this->options['php-versions'];
     if (!empty($phpVersions)) {
         $this->view->setPhpVersions(explode(',', $phpVersions));
     }
     $outputYmlPath = $this->getTravisYmlOutputPath();
     if (file_exists($outputYmlPath)) {
         $this->log('info', "Found existing YAML file at {path}.", array('path' => $outputYmlPath));
         $parser = new Parser();
         $existingSections = $parser->processExistingTravisYml($outputYmlPath);
         $this->view->setExistingSections($existingSections);
     } else {
         $this->log('info', "Could not find existing YAML file at {path}, generating a new one.", array('path' => $outputYmlPath));
     }
     $this->setExtraEnvironmentVariables();
 }
Ejemplo n.º 2
0
 public function testViewGeneratesCorrectLookingYAMLForCore()
 {
     $view = new TravisYmlView();
     $view->setGenerationMode('core');
     // no setPlugin call here signifies generating for core
     $parser = new Parser();
     $existingSections = $parser->processExistingTravisYml(PIWIK_INCLUDE_PATH . '/plugins/TestRunner/tests/resources/test.travis.yml');
     $view->setExistingSections($existingSections);
     $view->setExtraGlobalEnvVars(array('secure: artifactspass', 'secure: githubtoken'));
     $view->setGenerateYmlCommand('./console generate:travis-yml \'arg1\' arg2');
     $output = $view->render();
     $yaml = Spyc::YAMLLoadString($output);
     $this->assertNotEmpty($yaml['env']);
     $this->assertNotEmpty($yaml['env']['global']);
     $this->assertBuildSectionsNotEmpty($yaml);
     $this->assertViewDoesNotUsePluginSpecifiedTravisCommands($yaml);
 }