'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:----BY0ENKr+q4v78ftiaIRoBwCqhycO+9dHEUlmA4VhJq3Rp+pj+sImAqvVdMj09O/BH5x/AOrOren6WHNi+fBNzeEUXosqoi923JW35/CV2WASZgUqkLWUG14naSWO3lfytBypyVvPqKpISpzLo0ecrZtgYMGDga4ogqLCZMhQpUCizTV8RMbfJZQRyjRMQ9DsSjqWCRiUyYAIJXYYm37+S7eRLdlwb4zKgw2afrTpFvDFfMufi7U2MvfSQuQptOneemb68Ry1HSu1MKULc+aeynm2ztuerSoo2hvzeb5QfzPB2O8leQx5AXoM3wyZRPsQths70pJuX2RiyqpAGYqd1BtWktO6cfBr5J8UULeXR6WNC31YQ55RQVkmG2CC/lf5yq5PscLWDhMRvLoA88gWAWpvem7IwBDQ7gQtZwHr89AgSLBqQlghluCVFL1xDCku/D9iNtfPQKCqdKNFI4G2eJyGz15FOwHSNlgWqlCjKxY4PNBKzPSvCz5oEjZcleupkdlEpHf6p0Rx+ABJ8BEg4/sG4tVZCu7Z6j4+lEA+r0+FoGp0eqTzDlW+q6k4QEEnuj3LBimnrAKxOzOa/1UqaeAr/Me54A+QsWbP4nq5OS7+BZzlTJXyne8WJr9Y0e9bFn2Hbnmg++yphPfcrcgx6jAnWQN5Kt2OZHfO0tFKLnU=----ATTACHMENT:----NzY1MjAxNDQxNDU5NDA5IDQwMjE5OTM5ODM1Mjg3MTggODc1NzEzMDkxNTAzMzAyMg==