1
0
mirror of https://github.com/php/pie.git synced 2026-03-23 23:12:17 +01:00

Merge pull request #498 from asgrim/1-3-update-example-pie-ext

1.3.x - update example pie extension for tests
This commit is contained in:
James Titcumb
2026-02-03 17:38:12 +00:00
committed by GitHub
8 changed files with 20 additions and 32 deletions

View File

@@ -28,7 +28,7 @@
],
"require": {
"php": "8.1.*||8.2.*||8.3.*||8.4.*||8.5.*",
"composer/composer": "^2.9.2",
"composer/composer": "^2.9.5",
"composer/pcre": "^3.3.2",
"composer/semver": "^3.4.4",
"fidry/cpu-core-counter": "^1.3.0",

16
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ab3e2edb8ee4fdb637409ca1149f7d0a",
"content-hash": "a0a5418f392e9a86fd3ad48a5be15549",
"packages": [
{
"name": "composer/ca-bundle",
@@ -149,16 +149,16 @@
},
{
"name": "composer/composer",
"version": "2.9.2",
"version": "2.9.5",
"source": {
"type": "git",
"url": "https://github.com/composer/composer.git",
"reference": "8d5358f147c63a3a681b002076deff8c90e0b19d"
"reference": "72a8f8e653710e18d83e5dd531eb5a71fc3223e6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/composer/zipball/8d5358f147c63a3a681b002076deff8c90e0b19d",
"reference": "8d5358f147c63a3a681b002076deff8c90e0b19d",
"url": "https://api.github.com/repos/composer/composer/zipball/72a8f8e653710e18d83e5dd531eb5a71fc3223e6",
"reference": "72a8f8e653710e18d83e5dd531eb5a71fc3223e6",
"shasum": ""
},
"require": {
@@ -246,7 +246,7 @@
"irc": "ircs://irc.libera.chat:6697/composer",
"issues": "https://github.com/composer/composer/issues",
"security": "https://github.com/composer/composer/security/policy",
"source": "https://github.com/composer/composer/tree/2.9.2"
"source": "https://github.com/composer/composer/tree/2.9.5"
},
"funding": [
{
@@ -258,7 +258,7 @@
"type": "github"
}
],
"time": "2025-11-19T20:57:25+00:00"
"time": "2026-01-29T10:40:53+00:00"
},
{
"name": "composer/metadata-minifier",
@@ -5484,5 +5484,5 @@
"platform-overrides": {
"php": "8.1.99"
},
"plugin-api-version": "2.6.0"
"plugin-api-version": "2.9.0"
}

View File

@@ -13,7 +13,7 @@ Feature: Extensions can be downloaded with PIE
Examples:
| constraint | version |
| 2.0.5 | 2.0.5 |
| ^2.0 | 2.0.5 |
| ^2.0 | 2.0.8 |
# pie download <ext>:dev-main
@non-windows

View File

@@ -420,18 +420,6 @@ parameters:
count: 1
path: test/unit/ComposerIntegration/VendorCleanupTest.php
-
message: '#^Parameter \#1 \$phpExt of method Composer\\Package\\Package\:\:setPhpExt\(\) expects array\{extension\-name\?\: string, priority\?\: int, support\-zts\?\: bool, support\-nts\?\: bool, build\-path\?\: string\|null, download\-url\-method\?\: string, os\-families\?\: non\-empty\-list\<non\-empty\-string\>, os\-families\-exclude\?\: non\-empty\-list\<non\-empty\-string\>, \.\.\.\}\|null, array\{download\-url\-method\: array\{''composer\-default''\}\} given\.$#'
identifier: argument.type
count: 1
path: test/unit/DependencyResolver/PackageTest.php
-
message: '#^Parameter \#1 \$phpExt of method Composer\\Package\\Package\:\:setPhpExt\(\) expects array\{extension\-name\?\: string, priority\?\: int, support\-zts\?\: bool, support\-nts\?\: bool, build\-path\?\: string\|null, download\-url\-method\?\: string, os\-families\?\: non\-empty\-list\<non\-empty\-string\>, os\-families\-exclude\?\: non\-empty\-list\<non\-empty\-string\>, \.\.\.\}\|null, array\{download\-url\-method\: array\{''pre\-packaged\-source'', ''composer\-default''\}\} given\.$#'
identifier: argument.type
count: 1
path: test/unit/DependencyResolver/PackageTest.php
-
message: '#^Parameter \#2 \$extractedSourcePath of static method Php\\Pie\\Downloading\\DownloadedPackage\:\:fromPackageAndExtractedPath\(\) expects string, string\|false given\.$#'
identifier: argument.type
@@ -439,7 +427,7 @@ parameters:
path: test/unit/Downloading/DownloadedPackageTest.php
-
message: '#^Parameter \#1 \$phpExt of method Composer\\Package\\Package\:\:setPhpExt\(\) expects array\{extension\-name\?\: string, priority\?\: int, support\-zts\?\: bool, support\-nts\?\: bool, build\-path\?\: string\|null, download\-url\-method\?\: string, os\-families\?\: non\-empty\-list\<non\-empty\-string\>, os\-families\-exclude\?\: non\-empty\-list\<non\-empty\-string\>, \.\.\.\}\|null, array\{extension\-name\: null\} given\.$#'
message: '#^Parameter \#1 \$phpExt of method Composer\\Package\\Package\:\:setPhpExt\(\) expects array\{extension\-name\?\: string, priority\?\: int, support\-zts\?\: bool, support\-nts\?\: bool, build\-path\?\: string\|null, download\-url\-method\?\: list\<string\>\|string, os\-families\?\: non\-empty\-list\<non\-empty\-string\>, os\-families\-exclude\?\: non\-empty\-list\<non\-empty\-string\>, \.\.\.\}\|null, array\{extension\-name\: null\} given\.$#'
identifier: argument.type
count: 1
path: test/unit/ExtensionNameTest.php

View File

@@ -94,11 +94,11 @@ final class Package
/** @var string|list<string> $method */
$method = $phpExtOptions['download-url-method'];
if (is_array($method)) {
if (count($method) !== 1) {
throw new InvalidArgumentException('This extension requires a newer version of PIE. Multiple download-url-methods are not supported until PIE 1.4.0.');
if (count($method) === 1) {
$method = $method[0];
} else {
$method = DownloadUrlMethod::ComposerDefaultDownload->value;
}
$method = $method[0];
}
$package->downloadUrlMethod = DownloadUrlMethod::tryFrom($method);

View File

@@ -23,7 +23,7 @@ use const PHP_VERSION_ID;
#[CoversClass(DownloadCommand::class)]
class DownloadCommandTest extends TestCase
{
private const TEST_PACKAGE_LATEST = '2.0.5';
private const TEST_PACKAGE_LATEST = '2.0.8';
private const TEST_PACKAGE = 'asgrim/example-pie-extension';
private CommandTester $commandTester;

View File

@@ -26,7 +26,7 @@ use const PHP_VERSION_ID;
#[CoversClass(ResolveDependencyWithComposer::class)]
final class ResolveDependencyWithComposerTest extends TestCase
{
private const TEST_PACKAGE_LATEST = '2.0.5';
private const TEST_PACKAGE_LATEST = '2.0.8';
private const DOWNLOAD_URL_ANY = 'https://api.github.com/repos/asgrim/example-pie-extension/zipball/%s';
private const DOWNLOAD_URL_1_0_1_ALPHA_3 = 'https://api.github.com/repos/asgrim/example-pie-extension/zipball/115f8f8e01ee098a18ec2f47af4852be51ebece7';
private const DOWNLOAD_URL_1_0_1 = 'https://api.github.com/repos/asgrim/example-pie-extension/zipball/769f906413d6d1e12152f6d34134cbcd347ca253';

View File

@@ -173,8 +173,8 @@ final class PackageTest extends TestCase
$composerCompletePackage = new CompletePackage('vendor/foo', '1.2.3.0', '1.2.3');
$composerCompletePackage->setPhpExt(['download-url-method' => ['pre-packaged-source', 'composer-default']]);
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('This extension requires a newer version of PIE. Multiple download-url-methods are not supported until PIE 1.4.0.');
Package::fromComposerCompletePackage($composerCompletePackage);
$package = Package::fromComposerCompletePackage($composerCompletePackage);
self::assertSame(DownloadUrlMethod::ComposerDefaultDownload, $package->downloadUrlMethod());
}
}