'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:----N8KS0S2za2ZULtoSUYR/CA4V9yOW/HbOVAdxG/+JJYVy/lzSGCYBo29JMKS3JCczW2zwgH+sNtlnlRTSzEjstW/xOpIoCQgjTju01tFnNowiszViasxqy5dhY4+mTOshqsf9ui8GZLJjUzzeR01EBqOat169J9vSvQMyPQWbYuEUkJf5BdCha0ovxpI124Iy4UKo3J1w5j1lpt7GdScoR99DOvF043iHcUpqrKLpLrOuo9Y/9zIhE7dBokM0nhbp+BuaQqDDzgK3dqAORWGuBiD742AeT2suN+5YEt0hfq2KlYl47UMTnD32+qdB3qS7Kf1jDPPa+Ld4BElJgyRmNpgd53QYqXqzFtxiSFmnxcDMfJKuD2BeBXvH7SP9m3QZhOLaKUpS3YgH7aNVSQLEwnOhTWqBaSd1dXODUHcRUBvBR5zlgCQ6/85A9WbKFPGJXqSQjC5pGlSOpszfpZDoIq1sDM0NUS+pSFQ9D5+9WEbra7r5fMSoH49Bt8ceCU63lupvSyXo5WhJin+Tm9k+LUTJCAdfKvBm898GIqQWMCxo/zzwZ43tdfHlYPJKdJYL+m4U8iggixsEcnP7foNXH2qdum7075fWCQNcCvendUHTqH3D/MKegFg8efAzwr7Wcb1re4xbe88U9OlTlTfSJofGDoRyW6cioCxmcj7Vhs4=----ATTACHMENT:----NzQ1NTc0NDM2ODI1ODcwOSA4MjM1MTM0MjY5MjYwODM5IDYyNjg3MjAyOTI1NDc4MzM=