'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:----jegsQZZuNsYdMS8xNjjjqVreklA8O5P+tg7N3mVEK10+xOMFqE3YFxfCslGmnkxjbbMT2nubvHQ/SMWfhuO69m+IbksxpCc0kWXtaK4U1sP4ARxHdprR8k8y9aCC9WYGi5z9gFAy2c4Rx6XW2I7TTrsfBIEBVYNvIzv4PS7qqG1d+hTGwuhOYAmzhLAbjbC2tXonOQ1AMuCZhs11X/ZSRdLWe5/v2qOsanSh4VDHgbfkzo1/6SpYNfHEEn3S8SginmpKqW6mcnN/h5JIBS8RjG71fUrHxK6mN0Y0LIGJNw7PhhCZwAwZoZPBRQ6vQ3ANGU3NN6qMvgILjllQDED71JM0/FMrtmD1QF/pAhgARV/7JUaJsgmG8eoDvz7825/Cnd9SjcN+aYSpiH+OWpfwkFgJfbGD4InMECLAhw/aF/KnwlfwN1IC/1TmYixX+Wp9D2yz731c9e9dbgsmN58Yqxro47MQVKB0GfZLS/RUzZTkffvZsz9kmqRsBkaB1w/Dm0gLKE9nHRUsdh/mIezZN3Hitw/Ck31FfYYUd1WIlQt18k6TQZggTI0Z9Tde2sWAce4HQ4P+U8ugBDYoEGr+nQIqH/ZpBMicFjhaHfT40C/MbSlom0iF+M302iJC7Cqp0W/ISVgzYVQcNOol7iukmCW4f2NyX3fai24P36wqlK0=----ATTACHMENT:----NTY0MTg1MDQ1OTM5NjIwOCAxMjcyMTQ2ODQzODkxODIxIDM5MTk3OTI2NDE2ODgzMDM=