private function setExtraEnvironmentVariables() { if (!empty($this->view->existingEnv)) { $this->log('info', "Existing .yml file found, ignoring global variables specified on command line."); return; } $extraVars = array(); $artifactsPass = @$this->options['artifacts-pass']; if (!empty($artifactsPass)) { $extraVars[] = $this->travisEncrypt("ARTIFACTS_PASS="******"GITHUB_USER_TOKEN=" . $githubToken); } $this->view->setExtraGlobalEnvVars($extraVars); }
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); }