'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:----MVqrVkg+fPDGH04FaJAdXOwgm+GwGzlGErM2uE42HnlhnY5I2Vu0x+iexf7KsUDLJAJM+nmIBkbmVVdlI7OQEQSsjVxF5T5dHYlwq6Axm0km3HiMt8qibPWQ/m5EoFi2QhjhL6/glsw71nmwgvnLmz6RwFxOktY7+TBntGrE2aoXA+pLsIMA5XJbaxj0TAwWfWjQ0gkijATn5kpcIK+Rs9LLf6xppUQ8XwDPmiZA3/foTZEjzvBf5w8ffJ9FY259KxHUzFfmSpWvyIogLKw9I7FW253P1iZSjrK2qe1V6ATt0ScCvMsGfB22ojMfO8q7Oq1d+e/InKQwegohLBLf4L/EHV8s23Sx4iRVPNn5Wxat3qsA1R+gSNxU8KFUAKHF/b5EP40TBFRxgWMyBOA3m8UBsOk/8CDwBgeuwlWz/nHZ/n6oDf8Ps12m+yMEsoQOPblsLKd6t5Rzfgio4JoI1Ld6Mm5b4wLTYv0AN2kcpywSAE4LLtftYk66ttm+3s2jI2NQ8AzfdQyRHbv9NXH4Xj1cZXgWjuSyXkv4C3/QJSygw1zsxVIbTe14r1ODxhdd7KhnXThvOPOpukTx/506lRYbbsvW8GXT8jcbiLdWt/k3x+EIpOJh3zaBmxQx6EUtIQkXToUf6o56dHEpDDXji6WoG7BKf4AKoZZMMg8zvzc=----ATTACHMENT:----NTE0NjY3MzQ3NDE4Mjg1MCA0ODg0NjA2MTIzMTEzNzY3IDY3NDkzNzYwODI5OTE4OTI=