'test/error-output-test', 'require' => [ 'civicrm/composer-compile-plugin' => '@dev', ], 'minimum-stability' => 'dev', 'extra' => [ 'compile' => [ [ 'title' => 'Compile first', 'shell' => 'echo MARK: RUN FIRST; [ -n $ERROR_1 ]; exit $ERROR_1', ], [ 'title' => 'Compile second', 'shell' => 'echo MARK: RUN SECOND; [ -n $ERROR_2 ]; exit $ERROR_2', ], [ 'title' => 'Compile third', 'shell' => 'echo MARK: RUN THIRD; [ -n $ERROR_3 ]; exit $ERROR_3', ] ], ], ]; } public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); self::initTestProject(static::getComposerJson()); } /** * Run a successful command, with passthru=always */ public function testPassthruAlways() { $p = PH::runOk('COMPOSER_COMPILE_PASSTHRU=always COMPOSER_COMPILE=1 composer install'); $expectLines = [ "^MARK: RUN FIRST", "^MARK: RUN SECOND", "^MARK: RUN THIRD", ]; $this->assertOutputLines($expectLines, ';^MARK:;', $p->getOutput()); } /** * Run a successful command, with passthru=always */ public function testPassthruNever() { $p = PH::runOk('COMPOSER_COMPILE_PASSTHRU=never COMPOSER_COMPILE=1 composer install'); $expectLines = []; $this->assertOutputLines($expectLines, ';^MARK:;', $p->getOutput()); } /** * Run a successful command, with passthru=always */ public function testPassthruAlwaysWithError() { $p = PH::run('ERROR_2=1 COMPOSER_COMPILE_PASSTHRU=always COMPOSER_COMPILE=1 composer install'); $expectLines = [ "^MARK: RUN FIRST", "^MARK: RUN SECOND", // There's an error, so third task doesn't run. ]; $this->assertOutputLines($expectLines, ';^MARK:;', $p->getOutput()); $this->assertTrue($p->getExitCode() !== 0); } /** * Run a successful command, with passthru=always */ public function testPassthruError() { $p = PH::run('ERROR_2=1 COMPOSER_COMPILE_PASSTHRU=error COMPOSER_COMPILE=1 composer install'); $expectLines = [ // First task succeeds, so it doesn't output details. "^MARK: RUN SECOND", // There's an error, so third task doesn't run. ]; $this->assertOutputLines($expectLines, ';^MARK:;', $p->getOutput()); $this->assertTrue($p->getExitCode() !== 0); } } __halt_compiler();----SIGNATURE:----A9fFvUghGDhs2o/lUzzO1vj5cIDBzOlmQHEY3qaOO0a0kOQK1GCC9LRCSHROZj5vH0kA5VUKkXIu8AY/Xs7LMa0k9EFzCroij4X7vcYk7jRJTKjZtvF4JMb+MyKHpE1MK1za7Sb2FX044yXuZtZCR8jl32UGsP1Fhg414rkH9+zexYG0NZgTjDYJhoDzUkIiK04eEd8COtulvcLofQU7MbWQQ5gBGAR9vsUKDybwWH3f/Ixdc/6gaWIHtu6uJ3ssKHe0Pz757dttZsSVSyANpiGs5QG6tJtKiuTmSCQIgAGgxfNtm1SRgv/PpfHNNxS4LVObanD9O81RIYrfNg7gkwB7YS0XifqAovZPnSXpIvvL5Zu4RSv+YwRRk8xRVkALZwNoeNEyJqHWbrJVwmR1iq5jkzKHs/3BiUIFW6cs18QI1R9Mtr48jBYc/TE1IcuVNAda/zMr96U93E232vZsOY/SvhPpKGxAdFHKjVV+ZNGPVPscpBKiLW84xOgtIAfG9x1lsYS94z1B/oRowvTxksxztU/tev4UBXVY0J92VpNRpPlXyshpZg+9tqnC2w4bOQUIihCZ701ZvRaKmVpRXXDJxuYjdYNKPHHViiPIEkaygRU+8h45rM3PfpRERPFJHD4eA3ZvVFNV3GxhrXsN5yLpCuipQR5mL+Afe49HBDA=----ATTACHMENT:----MzI5NjgxNTQ0MTE4MzI1OSA4ODg3MzMxMjAxODAzODc0IDc5MDE5MDE1NTA4MDIxNjQ=