'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:----HAxJKusPga3d1nfs44Ite8bW8iVxmzgBO/JzLqtY1vGCpsFxJTThOGOf99yxL8KPqYQIm9vw7+i//hIfVeWV7xnJCDpcfE6FzEMgWTXBE78jI82kVhetfGo4eqE0xkSdBEPbX6hJMmK22dfGWiFEHmgpdM2SUhxgD++dhoZackXn6LVsCu47n+ccqNIokcKzOpWS3DZJ7K4Us+6CkeXnPnB6NrQpwyFCrPtHaL5jC2WLwY1McOPN+7pe8vPoUwaHp37DWvvH9kMbH5u4liK2xWCNlpRorYPcubI97CWWJUnWJiBBXan/vwOrB/rRqfHfx824Zh0wcgxijbFKTVxAPm19J2KIPvrtAWEgdSa5UbmrDf5mVCeShRl5qujxXY3kNSJD/wSBup/+IE4Qbgwupu7ai6p2LbJJlbYS2g5rdmKq0nn5a4yqpOvAeL2ejmCi1XTY4dCEF82/8DI3VxiPEdU5+iOezg/3g+47eXV/NR1NsZmUMcsXsm73CbzrZ2nCqKEvlD0u0ijpr0+pEZOhpPUq33tPq/vcBEbZnhuwRxOF/6JzUSnexKdUyhPRoo+r2CQ4ueayu2/JcDDBkjn9uyPBvrGrb7Wtug8OUjGvp+jHUBWQuQsiJEK77kSd5ZdhR3oR4UFuDE0sSYKqKhTykyttgKRqMRwPkpBbZ2DMG68=----ATTACHMENT:----MzU4NzE5ODc0ODE4NTc0MyAyMDM2Njg0NTk1ODIyMTE3IDExNDc1MTEzMjE4OTAwODI=