'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 = 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:----jdmG5yd84bkNj2J8stj27mujiBY0R+yMAtmh3qCBaQzOoZ9qQu3WGfHQXFq+gGD7OYdAZprP+ZzAUfNfig121SJ2g3W6nCOWrQjN6Pd/qR+4nlALg8j49wwuq1P62PZ/sKtkfOrPrF23KwFO5+GHsVLmKDeI8Gr7lhZ3kDvIBDnuRcDxdZV6S9hWS4lLN27TSPXX4E1QQ2L89Bw0f4qfEwabrMP8kiCrIbyK0C1mn1/mTQM2bX7ELssrKQOUnKHXnpK24I3SMBdI1oV4AzN776lLmjpp5QhbYt9TN15a1NNYkdsBD6LfICxC8ig+CEih/reu6OuemG8i4iMhVPEHcQgWrQxCXlvPwqIj+gQmaGVYfokAYtuoOqwewpMAwOgV2DDH/L18GKQOKIA9oSY7bLKSm4HiAksSurE0YRh/NUsGhcRz6C6bgXLd76ohy3cmFNXacy0eZ5nsiYZcuQ2ZZIddlVWdd/X51eQ+czjC12bmLHFg8sOuObJOkmCq8hMEhoJ45KPJay64Q08Kv5tXN2PVZf5aHWKEr+JolgQBhWFk5KISoMvwqMOgNgBdHSZokT/J7XrNU0QTPYT5U6zf51YE6wF+BNuK9zwY8rRGrp1Ae351xQjLBQf/XgRFABPODZINumESCRiIP4auviQLJBHt6FygL0r5YTSPldmS2BM=----ATTACHMENT:----NzAxNTYyMzA2MjYyMjIwNyA4MzIzMzgyMDI0MzUxNzc0IDYyOTI2NTQ1NzQyNDA5Njg=