function it_returns_the_date_of_the_commit(Shell $shell) { $shell->run('git log -1 -s --format=%ci 3f04264')->willReturn('2014-11-28 01:01:58 +0100'); $this->setShellRunner($shell); $this->setArguments(array('from' => '1.0', 'to' => '3f04264')); $this->getToDate()->shouldReturn('2014-11-28'); }
function it_runs_the_whole_process(Shell $shell) { file_put_contents($this->gitConfigFile, $this->gitConfig); $shell->run(sprintf('git log --pretty=format:"%%s%s%%b" 1.2.3..4.0.0', Git::MSG_SEPARATOR))->willReturn($this->getLogAsString()); $this->beConstructedWith(new ConfigLoader(), $this->gitConfigFile, true); $this->getParser()->getVcsParser()->shouldHaveType('\\ReadmeGen\\Vcs\\Type\\Git'); $this->getParser()->setArguments(array('from' => '1.2.3', 'to' => '4.0.0')); $this->getParser()->setShellRunner($shell); $log = $this->getParser()->parse(); $this->setExtractor(new Extractor()); $logGrouped = $this->extractMessages($log)->shouldReturn(array('Features' => array('bar baz #123', 'dummy feature', 'lol'), 'Bugfixes' => array('some bugfix'))); $formatter = new Md(); $formatter->setFileName($this->outputFile)->setRelease('4.5.6')->setDate(new \DateTime(2014 - 12 - 12)); $this->setDecorator(new Decorator($formatter)); $this->getDecoratedMessages($logGrouped)->shouldReturn(array('Features' => array('bar baz [#123](http://issue.tracker.com/123)', 'dummy feature', 'lol'), 'Bugfixes' => array('some bugfix'))); $outputWriter = new Writer($formatter); $this->setOutputWriter($outputWriter); $this->writeOutput()->shouldReturn(true); }
/** * Runs the shell command and returns the result. * * @param $command * * @return string */ protected function runCommand($command) { return $this->shell->run($command); }