'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:----RHWFwQlRlm2vHec9VOVenxhgF1Jhz12yW/bx/UlC106cxsBogzLEC5+Dyb8i8H963uMjqYXAdy0ZMK3kZ54JGxnF8oeV7PSpNsLEfoDS0qXMWD+dcJqm2YTR/2MzXBTBwbIM9c4sVDFHh9upTby+kgseZSPaEogmqGiexJALpiygI1wEyCyohdPFQfz5lFWW9IsVNEbYxUYV4bPfnbJTf29Z1P3lLqx+HEok+CF64rFU9FuJmWhTT81f0LCwDAYX5DB11MbM91OvilhTUIciYLcs/B97ey0QsJgQdR7rugG7hVzd8bQoX8uWz3eHyHc73DRX/fVFfGz0gUEbTXpwzkbGwfdf7lxGxBM74/NqhYaeJ14vwPdMUi9jf7AHN7vLd6FKgSjKJpc/uqo2P8zbDEI2OWbfyY3D8pujTfC3mMM0dXZ1N0ujR7/XMVyoQgdTHMPjOL1kWNnyFlh4IokivnHSLXNGa7Z89qnvDGfNQ35HvD9fSkyX4K3pJfJu86V3EEUe7yZHQj1MgCubv5U9sfzEx3nsNp20qhsNiBaIyRqBioGhjtpSAwg12p1ZiyPaNJG3oOefcI9UEkUBtq+wHaM0t1XCSOCFrwKVVoOwS6cClvl4NhBIrmIAuDBaLXWOJAmzn2pJH+nJ9NFn0HP5o0YNUigf4rtFzPeOwYZk7VQ=----ATTACHMENT:----ODE2MzcyMzY5NzcwMDE2NiAzMzA1ODc2NTk4MDA5MjEyIDExNzkzNTcwNzY2MjQyNjc=