'test/event-test', 'require' => [ 'civicrm/composer-compile-plugin' => '@dev', ], 'minimum-stability' => 'dev', 'scripts' => [ CompileEvents::PRE_COMPILE_LIST => 'echo MARK: PRE_COMPILE_LIST', CompileEvents::POST_COMPILE_LIST => 'echo MARK: POST_COMPILE_LIST', CompileEvents::PRE_COMPILE_TASK => 'echo MARK: PRE_COMPILE_TASK', CompileEvents::POST_COMPILE_TASK => 'echo MARK: POST_COMPILE_TASK', ], 'extra' => [ 'compile' => [ [ 'title' => 'Compile first', 'shell' => 'echo MARK: RUN FIRST', ], [ 'title' => 'Compile second', 'shell' => 'echo MARK: RUN SECOND', ] ], ], ]; } public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); self::initTestProject(static::getComposerJson()); } /** * When running 'composer install', it run various events. */ public function testComposerInstall() { $p = PH::runOk('COMPOSER_COMPILE_PASSTHRU=always COMPOSER_COMPILE=1 composer install'); $expectLines = array_merge($this->startupLines(), [ // First task "^MARK: PRE_COMPILE_TASK", "^MARK: RUN FIRST", "^MARK: POST_COMPILE_TASK", // Second task "^MARK: PRE_COMPILE_TASK", "^MARK: RUN SECOND", "^MARK: POST_COMPILE_TASK", ]); $this->assertOutputLines($expectLines, ';^MARK:;', $p->getOutput()); } public function testDryRun() { $p = PH::runOk('COMPOSER_COMPILE_PASSTHRU=always COMPOSER_COMPILE=1 composer compile --dry-run'); $expectLines = array_merge($this->startupLines(), [ // First task "^MARK: PRE_COMPILE_TASK", // Not on dry-run: "^MARK: RUN FIRST", "^MARK: POST_COMPILE_TASK", // Second task "^MARK: PRE_COMPILE_TASK", // Not on dry-run: "^MARK: RUN SECOND", "^MARK: POST_COMPILE_TASK", ]); $this->assertOutputLines($expectLines, ';^MARK:;', $p->getOutput()); } protected function startupLines() { // $pkgCount = 3; // All installed packages $pkgCount = 1; // Only packages with predefined tasks $r = []; for ($i = 0; $i < $pkgCount; $i++) { $r[] = "^MARK: PRE_COMPILE_LIST"; $r[] = "^MARK: POST_COMPILE_LIST"; } return $r; } } __halt_compiler();----SIGNATURE:----U8yDhIxGVwRX8prmDYFTzPRImoQKze0IQhH2F5uKRAhE67Xx6jZkUoNhg53sllCzokvqJblQS0IshosV+UDzu9k4JbdOb8WY6iZU2j3lIllhpLqKt0eyV68826opgSnKMLRA+TO5ZWcbE0tMXULIxQqGgdCSitbniqC9RSSZZ4KWovQInvY4pkxnfjVwjkZCLqNfe8AaYCaRUMqWaKsIQe2jZvfYozMhpAMzSAYZGvDr+z4YRfs1tLl+6FXWxbiXICxSvO50vPjvApC9LTnvMbfi4v/ZACH4yyI8htaZKB/mxStaSgU+MowFT64xLtT1EqiooUDiJjyhSIV3T3h3wChvwaE4+ez/uo3EqrbnXjQVfd+roT7eqQ72rJ52Hmli34eRqV2IoB7KPLP8XUW3CaYC9d9Z9b2Jr2uTerN1Lc2ZYKRJaBzXVsEPa6hsq46DMaN6CFMbTuKkYvRESqeU+u585ncFI1v+/9tzmwRwMOOPxQ1cSRtDfN0DNJ+a1x+N4w6IqH+TxO78MGiFfEf4b6llcACW3BsxR82clmqWLxMI9actCE2dz0Pe466AgEDCo0d4MyUAEs/vRAew5cLFX9xBZEayLqOrKESG7JntYf4YOam9Fl2AiWESSBO1jrxyY8/WaVD+aAjE6MOQDsJ0609b5YmNmT3B/mw60OXiQ9A=----ATTACHMENT:----MTkyMTU5MTc4NzM1NDI2OSA3NjQ2NjExNDk3MjcxMzM1IDQ5MTgyMjI3MTAxNjY3MTI=