Skip to content

Commit

Permalink
Merge e29a99d into f35fb9c
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed Feb 9, 2019
2 parents f35fb9c + e29a99d commit 43af9e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/CosyComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ public function run()
$command = sprintf('COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi %s %s:%s%s %s', $req_command, $package_name, $constraint, $version_to, $with_dep_suffix);
$this->execCommand($command, false, 600);
} else {
$command = sprintf('COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n --no-scripts %s %s', $package_name, $with_dep_suffix);
$command = sprintf('COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n %s %s', $package_name, $with_dep_suffix);
$this->log('Running composer update for package ' . $package_name);
// If exit code is not 0, there was a problem.
if ($this->execCommand($command, false, 600)) {
Expand Down Expand Up @@ -985,7 +985,7 @@ public function setOutput(OutputInterface $output)
private function cleanUp()
{
// Run composer install again, so we can get rid of newly installed updates for next run.
$this->execCommand('COMPOSER_DISCARD_CHANGES=true COMPOSER_ALLOW_SUPERUSER=1 composer install --no-ansi -n --no-scripts', false, 1200);
$this->execCommand('COMPOSER_DISCARD_CHANGES=true COMPOSER_ALLOW_SUPERUSER=1 composer install --no-ansi -n', false, 1200);
$this->chdir('/tmp');
$this->log('Cleaning up after update check.');
$this->log('Storing custom composer cache for later');
Expand Down Expand Up @@ -1110,7 +1110,7 @@ protected function doComposerInstall()
}
// @todo: Should probably use composer install command programatically.
$this->log('Running composer install');
if ($code = $this->execCommand('COMPOSER_DISCARD_CHANGES=true COMPOSER_ALLOW_SUPERUSER=1 composer install --no-ansi -n --no-scripts', false, 1200)) {
if ($code = $this->execCommand('COMPOSER_DISCARD_CHANGES=true COMPOSER_ALLOW_SUPERUSER=1 composer install --no-ansi -n', false, 1200)) {
// Other status code than 0.
$this->log($this->getLastStdOut(), Message::COMMAND);
$this->log($this->getLastStdErr());
Expand Down
15 changes: 8 additions & 7 deletions test/integration/UpdatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private function createUpdateJsonFromData($package, $version, $new_version)

private function createExpectedCommandForPackage($package)
{
return "COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n --no-scripts $package --with-dependencies";
return "COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n $package --with-dependencies";
}

public function testUpdatesFoundButProviderDoesNotAuthenticate()
Expand Down Expand Up @@ -303,7 +303,7 @@ public function testUpdatesFoundButComposerUpdateFails()
->will($this->returnCallback(
function ($cmd) use (&$called, &$composer_update_called) {
$return = 0;
if ($cmd == 'COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n --no-scripts psr/log --with-dependencies') {
if ($cmd == $this->createExpectedCommandForPackage('psr/log')) {
$composer_update_called = true;
$return = 1;
}
Expand Down Expand Up @@ -443,7 +443,8 @@ public function testUpdatesRunButErrorCommiting()
->will($this->returnCallback(
function ($cmd) use (&$called, $dir) {
$return = 0;
if ($cmd == 'COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n --no-scripts psr/log --with-dependencies') {
$command = $this->createExpectedCommandForPackage('psr/log');
if ($cmd == $command) {
file_put_contents("$dir/composer.lock", file_get_contents(__DIR__ . '/../fixtures/composer-psr-log.lock-updated'));
}
if ($cmd == 'GIT_AUTHOR_NAME="" GIT_AUTHOR_EMAIL="" GIT_COMMITTER_NAME="" GIT_COMMITTER_EMAIL="" git commit composer.* -m "Update psr/log"') {
Expand Down Expand Up @@ -516,7 +517,7 @@ public function testUpdatesRunButErrorPushing()
->will($this->returnCallback(
function ($cmd) use (&$called, $dir) {
$return = 0;
if ($cmd == 'COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n --no-scripts psr/log --with-dependencies') {
if ($cmd == $this->createExpectedCommandForPackage('psr/log')) {
file_put_contents("$dir/composer.lock", file_get_contents(__DIR__ . '/../fixtures/composer-psr-log.lock-updated'));
}
if ($cmd == 'git push origin psrlog100102 --force') {
Expand Down Expand Up @@ -589,7 +590,7 @@ public function testEndToEnd()
->will($this->returnCallback(
function ($cmd) use (&$called, $dir) {
$return = 0;
if ($cmd == 'COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n --no-scripts psr/log --with-dependencies') {
if ($cmd == $this->createExpectedCommandForPackage('psr/log')) {
file_put_contents("$dir/composer.lock", file_get_contents(__DIR__ . '/../fixtures/composer-psr-log.lock-updated'));
}
if (strpos($cmd, 'rm -rf /tmp/') === 0) {
Expand Down Expand Up @@ -664,7 +665,7 @@ public function testEndToEndNotPrivate()
->will($this->returnCallback(
function ($cmd) use (&$called, $dir) {
$return = 0;
if ($cmd == 'COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n --no-scripts psr/log --with-dependencies') {
if ($cmd == $this->createExpectedCommandForPackage('psr/log')) {
file_put_contents("$dir/composer.lock", file_get_contents(__DIR__ . '/../fixtures/composer-psr-log.lock-updated'));
}
if (strpos($cmd, 'rm -rf /tmp/') === 0) {
Expand Down Expand Up @@ -811,7 +812,7 @@ public function testEndToEndButNotUpdatedWithDependencies()
$mock_executer = $this->getMockExecuterWithReturnCallback(
function ($cmd) use (&$called, $dir) {
$return = 0;
if ($cmd == 'COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n --no-scripts psr/log ') {
if ($cmd == 'COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_DISCARD_CHANGES=true composer --no-ansi update -n psr/log ') {
file_put_contents("$dir/composer.lock", file_get_contents(__DIR__ . '/../fixtures/composer-psr-log.lock-updated'));
}
if (strpos($cmd, 'rm -rf /tmp/') === 0) {
Expand Down

0 comments on commit 43af9e7

Please sign in to comment.