Skip to content

Commit

Permalink
No test failing with hg < 3, fix coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
krtek4 committed Nov 16, 2015
1 parent 778ca88 commit dc484ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Liip/RMT/Config/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ protected function validateRootElements($config)
}
}

if($config['version-generator'] == 'simple'
if ($config['version-generator'] == 'simple'
&& isset($config['vcs']) && $config['vcs'] == 'hg'
&& (! isset($config['version-persister']['tag-prefix']) || strlen(trim($config['version-persister']['tag-prefix'])) == 0))
{
exec('hg version', $result);
preg_match('/version (\d+)\.\d+\.\d+/', reset($result), $matches);
if(intval($matches[1]) >= 3) {
if (intval($matches[1]) >= 3) {
throw new Exception("Simple generator is not compatible with mercurial > 3.");
}

Expand Down
6 changes: 5 additions & 1 deletion test/Liip/RMT/Tests/Functional/HgTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ public function testNoSimpleGenerator()
$this->initHg();
$this->createConfig('simple', 'vcs-tag', array('vcs' => 'hg'));
exec('./RMT release -n --confirm-first', $result, $code);
$this->assertEquals($code, 1);

exec('hg version', $result);
preg_match('/version (\d+)\.\d+\.\d+/', reset($result), $matches);
$expected = $matches[1]) >= 3 ? 1 : 0;
$this->assertEquals($code, $expected);
}

public function testInitialVersion()
Expand Down

0 comments on commit dc484ed

Please sign in to comment.