function it_should_save_a_variable_to_file_in_dry_run_mode(VariableContainer $variableContainer, FileReader $fileReader) { $text = ' "name": "John Doe" '; $params = array('filename' => 'fake.file.json', 'variable' => 'person', 'src' => '/"name" *: *"[^"]+"/', 'dest' => '"name": "{{ person }}"'); $fileReader->fileGetContents($params['filename'])->willReturn($text); // $variableContainer->getVariable('person')->willReturn('Lorem Ipsum'); $variableContainer->getVariables()->willReturn(array('person' => 'Lorem Ipsum')); $fileReader->filePutContents($params['filename'], ' "name": "Lorem Ipsum" ')->shouldBeCalled(); $this->setParams($params); $this->setVerbose(true); $this->exec()->shouldReturn(true); $this->getOutput()->shouldReturn('save_variable_to_file["name": "Lorem Ipsum"]'); }
function it_should_not_run_command_in_dry_mode(VariableContainer $variableContainer, Process $process) { $params = array('commandTemplate' => 'echo "Hello, {{ subjectOfGreeting }}"'); $variableContainer->getVariables()->willReturn(array('subjectOfGreeting' => 'WORLD')); $process->setCommandLine('echo "Hello, WORLD"')->shouldNotBeCalled(); $process->disableOutput()->shouldNotBeCalled(); $process->run()->shouldNotBeCalled(); $process->getExitCode()->shouldNotBeCalled(); $this->setParams($params); $this->setVerbose(true); $this->setDryRun(true); $this->exec()->shouldReturn(true); $this->getResult()->shouldReturn(null); $this->getOutput()->shouldReturn('command["echo "Hello, WORLD""]'); }