function it_should_except_when_regex_doesnt_match_file(FileReader $fileReader, ParseVariableAction $variableParser)
 {
     $text = 'abc';
     $params = array('filename' => 'f.json', 'regex' => '/def/');
     $fileReader->fileGetContents($params['filename'])->willReturn($text);
     $variableParser->exec()->willReturn(false);
     $variableParser->setParams(array('text' => $text, 'regex' => $params['regex']))->shouldBeCalled();
     $this->setParams($params);
     $this->setVerbose(true);
     $this->shouldThrow(new \RuntimeException(sprintf('Regex "%s" doesnt match anything in the file "%s"!', $params['regex'], $params['filename'])))->duringExec();
 }
 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"]');
 }