Пример #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();
 }
Пример #2
0
 public function testViewGeneratesCorrectLookingYAMLWhenCustomPhpVersionsUsed()
 {
     $view = new TravisYmlView();
     $view->setGenerationMode('plugin');
     $view->setPlugin('ExamplePlugin');
     $view->setPhpVersions(array('5.4', '5.6', 'hhvm'));
     $view->setGenerateYmlCommand('./console generate:travis-yml arg1 arg2');
     $output = $view->render();
     $yaml = Spyc::YAMLLoadString($output);
     $this->assertNotEmpty($yaml['php']);
     $this->assertEquals(array('5.4', '5.6', 'hhvm'), $yaml['php']);
 }