'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:----VaFQqFyXTVnx4pMLIcGSkZcJZLXqqir5C7s520ABoQ4FOoH6Fd+HCDG2picq2t16F2kPcHOJZD/FxYUNC5J+Jo/HlsBgrlMVDAPwqmLCEgfGMe9oA8hd1Gos64O71+KCVyAo+ahoDQSKT2+z5vsT1ZuvbPm3Q5dvia2I6s/22Fc4Xv3PTfPHjqsViPv7HP7hDf6COTfQEjy6TcG4ujUCAXCM0G8+k40nySIBqiESbHUuLaypQT7+7NjsSn0nQmw96OruNFRYesqht4IyYBSNAOy0cXpxJDQRRKO+tLfyTaQf+9GBKqtpdSxE8YkRR3hzHT3SO/91vhPclDGgZ4PeWcHxM5hqEaBpbPPjtg9btj35iH+qupQwU1zY+Lt8iImAeLjFnFrWVDFpu4/MVJ/8qM0dpNyALDQYRb0zgsWVdXNJN5x5/E6QrB333FZPlVg19jo5MMeeJIIkIKRue66Y6ZRCi9sZ8XvGTLqwhQtquyC1QNrm8kZM4myyuoDWiXjyj21rp+IwlqxrxreZIxAcgZQolIykoG3ylY2T29wXgi+kTrumsi0Go01Lsv/RXnnIyo1Ss31ra6g1Mvy2zoGiegEzvHR5c/M43ldUdAvh9yw4Dy+2QCCnV69WLOcftaICLzKEYVKzBnIZSgAGA/ay7MvcSQ62yGm3iEz58avTwk8=----ATTACHMENT:----NDU3NDUwODIxNTAxNDkyOSA3MDg1ODY0Njg1MTk5ODAzIDY0ODkxMjgxNDYzNjQ5MTk=