/** * * @param string $script * @return \Liip\RMT\Action\ExecuteAction */ protected function createAction($script) { $action = new \Liip\RMT\Action\ExecuteAction(array('script' => $script)); $context = new \Liip\RMT\Context(); $context->setService('output', $this->getMock("\\Liip\\RMT\\Output\\Output")); $action->setContext($context); return $action; }
protected function setUp() { parent::setUp(); $this->action = new VersionStampAction(array('file' => sys_get_temp_dir() . '/version.php', 'const' => 'TEST_VERSION')); $context = new \Liip\RMT\Context(); $context->setParameter('new-version', 'XYZ'); $context->setService('output', $this->getMock("\\Liip\\RMT\\Output\\Output")); $this->action->setContext($context); }
/** * Ensures that an exception is caught is the version is not in vcs #3 */ public function testCatchesVersionIsNotInVcs() { $file = sys_get_temp_dir() . '/test.xml'; @unlink($file); $options = array('file' => $file); $action = new \Liip\RMT\Action\ChangelogUpdateAction($options); $context = new \Liip\RMT\Context(); $vcs = $this->getMock("\\Liip\\RMT\\VCS\\VCSInterface"); $context->setService('vcs', $vcs); $persister = $this->getMock("\\Liip\\RMT\\Version\\Persister\\PersisterInterface"); $detector = $this->getMock("\\Liip\\RMT\\Version\\Detector\\DetectorInterface"); $context->setService('version-detector', $detector); $context->setService('version-persister', $persister); $context->setParameter('new-version', '1.2.3'); $collector = $this->getMock("\\Liip\\RMT\\Information\\InformationCollector"); $context->setService('information-collector', $collector); $output = $this->getMock("\\Liip\\RMT\\Output\\Output"); $context->setService('output', $output); $action->setContext($context); $vcs->expects($this->once())->method('getAllModificationsSince')->will($this->throwException(new \Liip\RMT\Exception('Error while executing git command'))); $action->execute(); $this->assertContains('version="1.2.3"', file_get_contents($file)); }