Fixed code. Changes improved code testability

main
Leszek Prabucki 13 years ago
parent de7f666118
commit 9488b0f85f

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

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

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

Loading…
Cancel
Save