'test/sniff-test', 'require' => [ 'civicrm/composer-downloads-plugin' => '@dev', ], 'minimum-stability' => 'dev', 'extra' => [ 'downloads' => [ '*' => [ 'path' => 'extern/{$id}', ], 'README' => [ 'url' => 'https://github.com/composer/composer/raw/1.9.0/README.md', 'path' => 'docs/README.md' ], 'jquery-full' => [ 'url' => 'https://github.com/civicrm/jquery/archive/1.12.4-civicrm-1.2.zip', ], 'jquery-lesser' => [ 'version' => '1.12.4-civicrm-1.2', 'url' => 'https://github.com/civicrm/jquery/archive/{$version}.zip', 'path' => 'extern/jquery-lesser', 'ignore' => ['Gruntfile.js'] ], 'cv' => [ 'type' => 'phar', 'url' => 'https://download.civicrm.org/cv/cv.phar-2019-08-20-14fe9da8', 'path' => 'bin/cv', ], ], ], 'config' => [ 'allow-plugins' => [ 'civicrm/composer-downloads-plugin' => true, ], ], ]; } public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); self::initTestProject(static::getComposerJson()); $composer_path = self::getComposerPath(); PH::runOk("$composer_path install -v"); } public function getExampleChecksums() { return [ ['docs/README.md', 'docs/README.md', '1d0577cc52d55f0680b431184e898f0cbcb927e52e843a319d7122db9be72813'], ['extern/jquery-full', 'extern/jquery-full/dist/jquery.js', '5f2caf09052782caf67e1772c0abce31747ffbc7a1c50690e331b99c7d9ea8dc'], ['extern/jquery-full', 'extern/jquery-full/Gruntfile.js', '3508ff74f8ef106a80f25f28f44a20c47a2b67d84396bb141928ff978ba4012e'], ['extern/jquery-lesser', 'extern/jquery-lesser/dist/jquery.js', '5f2caf09052782caf67e1772c0abce31747ffbc7a1c50690e331b99c7d9ea8dc'], ['extern/jquery-lesser', 'extern/jquery-lesser/Gruntfile.js', NULL], ['bin/cv', 'bin/cv', 'bf162d5d7dd0bef087d7dd07f474039b2e25c4bcca328a2b2097958ac6294476'] ]; } /** * Ensure that the file checksums match expectations with both (a) original download and (b) re-download. * * @param string $file * @param string|NULL $sha256 * The expected content of the file, or NULL if the file should not exist. * @dataProvider getExampleChecksums */ public function testDownloadAndRedownload($path, $file, $sha256) { // Initial download $this->assertFileChecksum($file, $sha256, 'Initial'); // Force re-download if (is_dir($path)) { self::cleanDir($path); } else { unlink($path); } $this->assertFileNotExists($file); $composer_path = self::getComposerPath(); PH::runOk("$composer_path install -v"); // And make sure it all worked out... $this->assertFileChecksum($file, $sha256, 'Redownload'); } public function assertFileChecksum($file, $sha256, $message = NULL) { if ($sha256 === NULL) { $this->assertFileNotExists($file, "($message) File should not exist"); } else { $this->assertFileExists($file, "($message) File should exist"); $this->assertEquals($sha256, hash('sha256', file_get_contents($file)), "($message) File should given checksum"); } } private static function getComposerPath() { return realpath(__DIR__ . '/../vendor/bin/composer'); } } __halt_compiler();----SIGNATURE:----Xz+CurZiTFYYC8Kw8qQa3t8T7ROm6slWkv7VfOnWql5OrnwJtpz0xSD/gdYMn8y0yFBxpdvdfNv98S6S6s4GEM4d8hnTRkckIqkYucMpivXgmlQPNR2ND1ezYKc2B4ZIDNcC1Fmhszr2yqOh1ojiBWOHNr1Rq/6ttmg4MMxgr5QfTXUNJv1AYkKAA4Oe/wL0c+iyXI/BqaeGQnFM8ToWLCVpCssOqZ2gsaiZ0Hp49bkDl5U72uhBp2u5asHalGyfw8+qSG72oZRy837raRlRuGg5MnkuN84st5YMDGmmg59tPj1kdZMMoZb2EqdzizU2uxF79QOtR6OxtWs/b4BZSoqvLrNkD9PAe1MXAFjVFqnjOolPdM9b1aCpA1/EyzxwHBIGce7atR6ulpNtYHtxdaYi5VCLVSCJQQkCC2ZMlkq3D5qpKWsc9Kjzwnj3PJF09cmqbKkQHCskNrDSv1YGk+wTKSAM/ewALQRkyqNL1As0/hwT+ll/K3n2ckXS/ygn2y/qdVOEmWh2dWGRoPXdu1q2loeftXjxQefTi6+U/hd2QqVsNxThSyoESCKvdi2HPpTbuf5Z0On3Bd+oNvo25mGxBW2wOXjqlcSqR6tUq/APB5WGBIzTab0ICIqTEudpLOI05K8gqnGvkvmchiA3M2lczntnC5omjEoISbSHs48=----ATTACHMENT:----Mzg0NDMxOTA5NjE3OTkxOSA5MTAwOTM1MDQ4OTM2MzEyIDE0MDgxODc1NDM5ODY1MzY=