'test/event-test', 'require' => [ 'civicrm/composer-compile-plugin' => '@dev', ], 'minimum-stability' => 'dev', 'extra' => [ 'compile' => [ [ 'title' => 'Compile first', 'run' => [ '@php-eval printf("PAYLOAD: SIZE: %d\n", strlen($GLOBALS["COMPOSER_COMPILE_TASK"]["payload"]));', '@php-eval printf("PAYLOAD: MODE: %s\n", getenv("COMPOSER_COMPILE_TASK")[0] === "@" ? "file" : "b64-gz-js");', ], 'payload' => self::computeLargePayload() ], ], ], ]; } 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 = [ "^PAYLOAD: SIZE: " . strlen(self::computeLargePayload()), "^PAYLOAD: MODE: file", ]; $this->assertOutputLines($expectLines, ';^PAYLOAD:;', $p->getOutput()); } /** * Make a string that is so longer/diverse that it cannot be transferred * via environment-variable. * * @return string */ protected static function computeLargePayload() { static $longString = null; if ($longString === null) { $encode = function ($x) { return base64_encode(gzencode(json_encode($x))); }; $compressionBuster = function ($base, $delta) { $r = ''; for ($i = 0; $i < strlen($base); $i++) { $r .= chr($delta + ord($base[$i])); } return $r; }; $base = file_get_contents(__FILE__); $delta = 0; $longString = ''; while (strlen($encode($longString)) < TaskTransfer::MAX_ENV_SIZE) { $longString .= $compressionBuster($base, $delta); $delta++; } } return $longString; } } __halt_compiler();----SIGNATURE:----Ipmd23wDPBJIE1ZbtOyl79MUWd4089/PkK/ag/ffjTubPk2NAqXCREj/B8xld3zEa0Za+dkNOozBxmBh4e73dejbIQCAUMvxgwYiIr55U6sEvcYAG4CEs7Dt1gnRCzP+SgY5yB1apCCo1AmMs0UwJ60ay0H3qDGSlEm2SgWAboMvtfyPwdbe1Ow7IZiX2NMHkvQLCauqQAvx7RfeqxIdyy09PgvRan9g6z1lxI1OQw3YHuKgR+ocq42iqWnVUhlHjsnXUBRZrIgX0yRuq60eH0FnGhp4F0lBe4zU/xqTBX5L+DrOnDz2NOmmaBMz0XOCfstkBnxsDQROR1bbVSHpid/yhvYakhpbfxFAvCigGKIAaSmT3xQJSjHm4fk2d1RbjpWYND/BMrp9Xvh/BiKfmZLgHARekGsPmY4mQF0rITsCh6zWXbNprbferwVChdXB2dZ8W2DW3saUaqY+2/bK1DwWKNTM2FWraR8fDx6LAtZ+9trLEd4umB9nVvRB3EWJYjNvixo4mzNg1WZEtPg7bJ4WoBZosDNwOJm2n8IVlvdGjfaIXrgOt/fBwwl86uyZv2AJ3tYJ07mVHWknImcD5OklPTcxGGJA2VSXeqWlb8JGNF+r9V5Lg9XBNMXS8Ygx+B7fnzIRuOrsCP7NQCEyloNWsacWHXzzZ0n2ePmXqJo=----ATTACHMENT:----OTk0NzAyMjEyNDQ1OTMxNiA0Mjg5NDM4MTcwMTI1MzcwIDU5MjE5MTEwNjQ0NzY0MTQ=