/** @test */ public function shouldNotParseInvalidVariableNames() { $placer = new VariablesPlacer(); $placer->setText('This % is a %var'); $placer->setVars(['var' => 'test', 'is' => 'none']); $result = $placer->place(); $this->assertEquals('This % is a %var', $result); }
/** * @param InputInterface $input * @param OutputInterface $output * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { $playbookFile = $input->getOption('playbook'); $playbook = $this->fileLoader->load($playbookFile); $this->variablesPlacer->setVars(Registry::get('container')['argv_parser']->all()); $this->variablesPlacer->setText($playbook); $playbook = $this->variablesPlacer->place(); $url = sprintf('http://%s:%d/playbook/run/', $input->getOption('host'), $input->getOption('port')); $response = $this->curlRequest->getCurlResult($url, [CURLOPT_POST => true, CURLOPT_POSTFIELDS => ['playbook' => urlencode($playbook), 'filename' => $playbookFile], CURLOPT_TIMEOUT_MS => 100000]); echo $response['body']; }