'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:----FeZJ03u+mxOWHiFWFHBzxv1VGdwggFtl/F3GGaK+eQDUVeqnuAXeBJLM7mQxORINq9UmQgr+pItkEeKnyGsA4pu0nUvyiVXSwR2KvHKvL4ZuY5xSmVAZUtOAOuVBONmg4hvaHaTgYLsCtQk7p6V+9TaOLeFaXwsjJPZakyA8Lk8yc6TCDvt5ZPs25t8qFxfOkvPuo6ChpWGic+mk6Kh8i84ANlL0MOnH8EbfejxzPi+mIOuCGmhjcmhN9tOQPC6FUKp1QtsWQUn+hU50lBK0WnkRRf2BXDp4jAZiUoGDpMudKy023QApJFuEzhea1nE/a7QDbDFW7GgfMfNDScVkiTtVxtGPAnlFRXbNSBE5chprrkSkctM8fimOKP69hWzGC8BKpHN+8f3pHWs5la11QnUo/qvS7Vy7aPq8W5xTKE0jALb4I7PXXnjLK/PL0flZzERQDVcLlJ/8s/ApAQb9Bu5XTZXnzmPzDfcpg7Y2YWeoaRThoLCnwKZpktwzRZ8NwLp7G0DmscQN1pU0iXmIFmB93JYEJkk6Z28FAiO7juHbZK+sJmHDGMqPcrbs7SwGO2qfC8KBMGILH8j6vuCa5+oD9Dgatf6/DV+G0pqHuBsppObqEFvtNkckhR/JW4KtCKtNo0exUCPmuCy7OgX/BnlvIOzWT0kuiLz83PHaxVc=----ATTACHMENT:----Nzc1MjAyODE3NDU1Mzg3OSAzOTMzNTIyMDIwNjE5MzkxIDE3MjUyMTc0MTI5MjA2ODA=