1
0
Fork 0

Fixed code. Changes improved code testability

pull/246/head
Leszek Prabucki 2012-01-22 22:11:10 +01:00
parent de7f666118
commit 9488b0f85f
3 changed files with 5 additions and 1 deletions

View File

@ -29,6 +29,8 @@ class Rule
public $next1;
public $next2;
public $ruleHash;
public function __construct(array $literals, $reason, $reasonData)
{
// sort all packages ascending by id
@ -85,7 +87,7 @@ class Rule
}
for ($i = 0, $n = count($this->literals); $i < $n; $i++) {
if (!$this->literals[$i]->getId() === $rule->literals[$i]->getId()) {
if (!($this->literals[$i]->getId() === $rule->literals[$i]->getId())) {
return false;
}
}

View File

@ -48,6 +48,7 @@ class GitDownloader extends VcsDownloader
*/
protected function enforceCleanDirectory($path)
{
$output = array();
$this->process->execute(sprintf('cd %s && git status --porcelain', escapeshellarg($path)), $output);
if (trim($output)) {
throw new \RuntimeException('Source directory has uncommitted changes');

View File

@ -48,6 +48,7 @@ class HgDownloader extends VcsDownloader
*/
protected function enforceCleanDirectory($path)
{
$output = array();
$this->process->execute(sprintf('cd %s && hg st', escapeshellarg($path)), $output);
if (trim($output)) {
throw new \RuntimeException('Source directory has uncommitted changes');