diff --git a/composer.json b/composer.json
index ba043ff4..cdc2c60e 100644
--- a/composer.json
+++ b/composer.json
@@ -28,22 +28,22 @@
],
"require": {
"php": "8.1.*||8.2.*||8.3.*||8.4.*",
- "composer/composer": "^2.8.5",
+ "composer/composer": "^2.8.6",
"composer/pcre": "^3.3.2",
"composer/semver": "^3.4.3",
"fidry/cpu-core-counter": "^1.2",
"illuminate/container": "^10.48.28",
"psr/container": "^2.0.2",
"symfony/console": "^6.4.17",
- "symfony/process": "^6.4.15",
+ "symfony/process": "^6.4.19",
"webmozart/assert": "^1.11"
},
"require-dev": {
- "behat/behat": "^3.18.1",
+ "behat/behat": "^3.19.0",
"doctrine/coding-standard": "^12.0",
- "phpunit/phpunit": "^10.5.44",
+ "phpunit/phpunit": "^10.5.45",
"psalm/plugin-phpunit": "^0.19.2",
- "vimeo/psalm": "^6.3.0"
+ "vimeo/psalm": "^6.8.8"
},
"replace": {
"symfony/polyfill-php81": "*",
diff --git a/composer.lock b/composer.lock
index c6ecdfbd..890a8925 100644
--- a/composer.lock
+++ b/composer.lock
@@ -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": "819abdc1a00f374dc389cde52c096979",
+ "content-hash": "7307a62dc5473933ec5aa8bfff69dcce",
"packages": [
{
"name": "composer/ca-bundle",
@@ -84,16 +84,16 @@
},
{
"name": "composer/class-map-generator",
- "version": "1.5.0",
+ "version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/composer/class-map-generator.git",
- "reference": "4b0a223cf5be7c9ee7e0ef1bc7db42b4a97c9915"
+ "reference": "ffe442c5974c44a9343e37a0abcb1cc37319f5b9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/class-map-generator/zipball/4b0a223cf5be7c9ee7e0ef1bc7db42b4a97c9915",
- "reference": "4b0a223cf5be7c9ee7e0ef1bc7db42b4a97c9915",
+ "url": "https://api.github.com/repos/composer/class-map-generator/zipball/ffe442c5974c44a9343e37a0abcb1cc37319f5b9",
+ "reference": "ffe442c5974c44a9343e37a0abcb1cc37319f5b9",
"shasum": ""
},
"require": {
@@ -137,7 +137,7 @@
],
"support": {
"issues": "https://github.com/composer/class-map-generator/issues",
- "source": "https://github.com/composer/class-map-generator/tree/1.5.0"
+ "source": "https://github.com/composer/class-map-generator/tree/1.6.0"
},
"funding": [
{
@@ -153,20 +153,20 @@
"type": "tidelift"
}
],
- "time": "2024-11-25T16:11:06+00:00"
+ "time": "2025-02-05T10:05:34+00:00"
},
{
"name": "composer/composer",
- "version": "2.8.5",
+ "version": "2.8.6",
"source": {
"type": "git",
"url": "https://github.com/composer/composer.git",
- "reference": "ae208dc1e182bd45d99fcecb956501da212454a1"
+ "reference": "937c775a644bd7d2c3dfbb352747488463a6e673"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/composer/zipball/ae208dc1e182bd45d99fcecb956501da212454a1",
- "reference": "ae208dc1e182bd45d99fcecb956501da212454a1",
+ "url": "https://api.github.com/repos/composer/composer/zipball/937c775a644bd7d2c3dfbb352747488463a6e673",
+ "reference": "937c775a644bd7d2c3dfbb352747488463a6e673",
"shasum": ""
},
"require": {
@@ -251,7 +251,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.8.5"
+ "source": "https://github.com/composer/composer/tree/2.8.6"
},
"funding": [
{
@@ -267,7 +267,7 @@
"type": "tidelift"
}
],
- "time": "2025-01-21T14:23:40+00:00"
+ "time": "2025-02-25T12:03:50+00:00"
},
{
"name": "composer/metadata-minifier",
@@ -1880,16 +1880,16 @@
},
{
"name": "symfony/process",
- "version": "v6.4.15",
+ "version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "3cb242f059c14ae08591c5c4087d1fe443564392"
+ "reference": "7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/3cb242f059c14ae08591c5c4087d1fe443564392",
- "reference": "3cb242f059c14ae08591c5c4087d1fe443564392",
+ "url": "https://api.github.com/repos/symfony/process/zipball/7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3",
+ "reference": "7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3",
"shasum": ""
},
"require": {
@@ -1921,7 +1921,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/process/tree/v6.4.15"
+ "source": "https://github.com/symfony/process/tree/v6.4.19"
},
"funding": [
{
@@ -1937,7 +1937,7 @@
"type": "tidelift"
}
],
- "time": "2024-11-06T14:19:14+00:00"
+ "time": "2025-02-04T13:35:48+00:00"
},
{
"name": "symfony/service-contracts",
@@ -2978,16 +2978,16 @@
},
{
"name": "behat/behat",
- "version": "v3.18.1",
+ "version": "v3.19.0",
"source": {
"type": "git",
"url": "https://github.com/Behat/Behat.git",
- "reference": "4621239e20fa4bb1ae1df1b2235fc930e6b27a13"
+ "reference": "6cf82375a88145e33e10a34b211a3f914cbd02ee"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Behat/Behat/zipball/4621239e20fa4bb1ae1df1b2235fc930e6b27a13",
- "reference": "4621239e20fa4bb1ae1df1b2235fc930e6b27a13",
+ "url": "https://api.github.com/repos/Behat/Behat/zipball/6cf82375a88145e33e10a34b211a3f914cbd02ee",
+ "reference": "6cf82375a88145e33e10a34b211a3f914cbd02ee",
"shasum": ""
},
"require": {
@@ -3006,12 +3006,12 @@
"symfony/yaml": "^5.4 || ^6.4 || ^7.0"
},
"require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.68",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^9.6",
"sebastian/diff": "^4.0",
"symfony/polyfill-php84": "^1.31",
- "symfony/process": "^5.4 || ^6.4 || ^7.0",
- "vimeo/psalm": "^5.0"
+ "symfony/process": "^5.4 || ^6.4 || ^7.0"
},
"suggest": {
"ext-dom": "Needed to output test results in JUnit format."
@@ -3064,30 +3064,36 @@
],
"support": {
"issues": "https://github.com/Behat/Behat/issues",
- "source": "https://github.com/Behat/Behat/tree/v3.18.1"
+ "source": "https://github.com/Behat/Behat/tree/v3.19.0"
},
- "time": "2025-01-10T10:08:15+00:00"
+ "time": "2025-02-13T09:07:11+00:00"
},
{
"name": "behat/gherkin",
- "version": "v4.11.0",
+ "version": "v4.12.0",
"source": {
"type": "git",
"url": "https://github.com/Behat/Gherkin.git",
- "reference": "32821a17b12620951e755b5d49328a6421a5b5b5"
+ "reference": "cc3a7e224b36373be382b53ef02ede0f1807bb58"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Behat/Gherkin/zipball/32821a17b12620951e755b5d49328a6421a5b5b5",
- "reference": "32821a17b12620951e755b5d49328a6421a5b5b5",
+ "url": "https://api.github.com/repos/Behat/Gherkin/zipball/cc3a7e224b36373be382b53ef02ede0f1807bb58",
+ "reference": "cc3a7e224b36373be382b53ef02ede0f1807bb58",
"shasum": ""
},
"require": {
+ "composer-runtime-api": "^2.2",
"php": "8.1.* || 8.2.* || 8.3.* || 8.4.*"
},
"require-dev": {
"cucumber/cucumber": "dev-gherkin-24.1.0",
- "phpunit/phpunit": "^9.6",
+ "friendsofphp/php-cs-fixer": "^3.65",
+ "phpstan/extension-installer": "^1",
+ "phpstan/phpstan": "^2",
+ "phpstan/phpstan-phpunit": "^2",
+ "phpunit/phpunit": "^10.5",
+ "symfony/filesystem": "^5.4 || ^6.4 || ^7.0",
"symfony/yaml": "^5.4 || ^6.4 || ^7.0"
},
"suggest": {
@@ -3112,11 +3118,11 @@
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
- "homepage": "http://everzet.com"
+ "homepage": "https://everzet.com"
}
],
"description": "Gherkin DSL parser for PHP",
- "homepage": "http://behat.org/",
+ "homepage": "https://behat.org/",
"keywords": [
"BDD",
"Behat",
@@ -3127,9 +3133,9 @@
],
"support": {
"issues": "https://github.com/Behat/Gherkin/issues",
- "source": "https://github.com/Behat/Gherkin/tree/v4.11.0"
+ "source": "https://github.com/Behat/Gherkin/tree/v4.12.0"
},
- "time": "2024-12-06T10:07:25+00:00"
+ "time": "2025-02-26T14:28:23+00:00"
},
{
"name": "behat/transliterator",
@@ -3253,6 +3259,58 @@
],
"time": "2022-01-17T14:14:24+00:00"
},
+ {
+ "name": "danog/advanced-json-rpc",
+ "version": "v3.2.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/danog/php-advanced-json-rpc.git",
+ "reference": "aadb1c4068a88c3d0530cfe324b067920661efcb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/danog/php-advanced-json-rpc/zipball/aadb1c4068a88c3d0530cfe324b067920661efcb",
+ "reference": "aadb1c4068a88c3d0530cfe324b067920661efcb",
+ "shasum": ""
+ },
+ "require": {
+ "netresearch/jsonmapper": "^5",
+ "php": ">=8.1",
+ "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0"
+ },
+ "replace": {
+ "felixfbecker/php-advanced-json-rpc": "^3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "AdvancedJsonRpc\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "ISC"
+ ],
+ "authors": [
+ {
+ "name": "Felix Becker",
+ "email": "felix.b@outlook.com"
+ },
+ {
+ "name": "Daniil Gentili",
+ "email": "daniil@daniil.it"
+ }
+ ],
+ "description": "A more advanced JSONRPC implementation",
+ "support": {
+ "issues": "https://github.com/danog/php-advanced-json-rpc/issues",
+ "source": "https://github.com/danog/php-advanced-json-rpc/tree/v3.2.2"
+ },
+ "time": "2025-02-14T10:55:15+00:00"
+ },
{
"name": "daverandom/libdns",
"version": "v2.1.0",
@@ -3513,51 +3571,6 @@
},
"time": "2024-12-07T21:18:45+00:00"
},
- {
- "name": "felixfbecker/advanced-json-rpc",
- "version": "v3.2.1",
- "source": {
- "type": "git",
- "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git",
- "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447",
- "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447",
- "shasum": ""
- },
- "require": {
- "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
- "php": "^7.1 || ^8.0",
- "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^7.0 || ^8.0"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "AdvancedJsonRpc\\": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "ISC"
- ],
- "authors": [
- {
- "name": "Felix Becker",
- "email": "felix.b@outlook.com"
- }
- ],
- "description": "A more advanced JSONRPC implementation",
- "support": {
- "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues",
- "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1"
- },
- "time": "2021-06-11T22:34:44+00:00"
- },
{
"name": "felixfbecker/language-server-protocol",
"version": "v1.5.3",
@@ -3848,16 +3861,16 @@
},
{
"name": "myclabs/deep-copy",
- "version": "1.12.1",
+ "version": "1.13.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
- "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845"
+ "reference": "024473a478be9df5fdaca2c793f2232fe788e414"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845",
- "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414",
+ "reference": "024473a478be9df5fdaca2c793f2232fe788e414",
"shasum": ""
},
"require": {
@@ -3896,7 +3909,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
- "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1"
+ "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0"
},
"funding": [
{
@@ -3904,20 +3917,20 @@
"type": "tidelift"
}
],
- "time": "2024-11-08T17:47:46+00:00"
+ "time": "2025-02-12T12:17:51+00:00"
},
{
"name": "netresearch/jsonmapper",
- "version": "v4.5.0",
+ "version": "v5.0.0",
"source": {
"type": "git",
"url": "https://github.com/cweiske/jsonmapper.git",
- "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5"
+ "reference": "8c64d8d444a5d764c641ebe97e0e3bc72b25bf6c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8e76efb98ee8b6afc54687045e1b8dba55ac76e5",
- "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5",
+ "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8c64d8d444a5d764c641ebe97e0e3bc72b25bf6c",
+ "reference": "8c64d8d444a5d764c641ebe97e0e3bc72b25bf6c",
"shasum": ""
},
"require": {
@@ -3953,9 +3966,9 @@
"support": {
"email": "cweiske@cweiske.de",
"issues": "https://github.com/cweiske/jsonmapper/issues",
- "source": "https://github.com/cweiske/jsonmapper/tree/v4.5.0"
+ "source": "https://github.com/cweiske/jsonmapper/tree/v5.0.0"
},
- "time": "2024-09-08T10:13:13+00:00"
+ "time": "2024-09-08T10:20:00+00:00"
},
{
"name": "nikic/php-parser",
@@ -4310,30 +4323,30 @@
},
{
"name": "phpstan/phpdoc-parser",
- "version": "1.33.0",
+ "version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
- "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140"
+ "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140",
- "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140",
+ "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9b30d6fd026b2c132b3985ce6b23bec09ab3aa68",
+ "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68",
"shasum": ""
},
"require": {
- "php": "^7.2 || ^8.0"
+ "php": "^7.4 || ^8.0"
},
"require-dev": {
"doctrine/annotations": "^2.0",
- "nikic/php-parser": "^4.15",
+ "nikic/php-parser": "^5.3.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/extension-installer": "^1.0",
- "phpstan/phpstan": "^1.5",
- "phpstan/phpstan-phpunit": "^1.1",
- "phpstan/phpstan-strict-rules": "^1.0",
- "phpunit/phpunit": "^9.5",
+ "phpstan/phpstan": "^2.0",
+ "phpstan/phpstan-phpunit": "^2.0",
+ "phpstan/phpstan-strict-rules": "^2.0",
+ "phpunit/phpunit": "^9.6",
"symfony/process": "^5.2"
},
"type": "library",
@@ -4351,9 +4364,9 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
- "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0"
+ "source": "https://github.com/phpstan/phpdoc-parser/tree/2.1.0"
},
- "time": "2024-10-13T11:25:22+00:00"
+ "time": "2025-02-19T13:28:12+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -4678,16 +4691,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "10.5.44",
+ "version": "10.5.45",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "1381c62769be4bb88fa4c5aec1366c7c66ca4f36"
+ "reference": "bd68a781d8e30348bc297449f5234b3458267ae8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1381c62769be4bb88fa4c5aec1366c7c66ca4f36",
- "reference": "1381c62769be4bb88fa4c5aec1366c7c66ca4f36",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bd68a781d8e30348bc297449f5234b3458267ae8",
+ "reference": "bd68a781d8e30348bc297449f5234b3458267ae8",
"shasum": ""
},
"require": {
@@ -4759,7 +4772,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
- "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.44"
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.45"
},
"funding": [
{
@@ -4775,7 +4788,7 @@
"type": "tidelift"
}
],
- "time": "2025-01-31T07:00:38+00:00"
+ "time": "2025-02-06T16:08:12+00:00"
},
{
"name": "psalm/plugin-phpunit",
@@ -4997,16 +5010,16 @@
},
{
"name": "revolt/event-loop",
- "version": "v1.0.6",
+ "version": "v1.0.7",
"source": {
"type": "git",
"url": "https://github.com/revoltphp/event-loop.git",
- "reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254"
+ "reference": "09bf1bf7f7f574453efe43044b06fafe12216eb3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/revoltphp/event-loop/zipball/25de49af7223ba039f64da4ae9a28ec2d10d0254",
- "reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254",
+ "url": "https://api.github.com/repos/revoltphp/event-loop/zipball/09bf1bf7f7f574453efe43044b06fafe12216eb3",
+ "reference": "09bf1bf7f7f574453efe43044b06fafe12216eb3",
"shasum": ""
},
"require": {
@@ -5063,9 +5076,9 @@
],
"support": {
"issues": "https://github.com/revoltphp/event-loop/issues",
- "source": "https://github.com/revoltphp/event-loop/tree/v1.0.6"
+ "source": "https://github.com/revoltphp/event-loop/tree/v1.0.7"
},
- "time": "2023-11-30T05:34:44+00:00"
+ "time": "2025-01-25T19:27:39+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -5985,32 +5998,32 @@
},
{
"name": "slevomat/coding-standard",
- "version": "8.15.0",
+ "version": "8.16.0",
"source": {
"type": "git",
"url": "https://github.com/slevomat/coding-standard.git",
- "reference": "7d1d957421618a3803b593ec31ace470177d7817"
+ "reference": "7748a4282df19daf966fda1d8c60a8aec803c83a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817",
- "reference": "7d1d957421618a3803b593ec31ace470177d7817",
+ "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7748a4282df19daf966fda1d8c60a8aec803c83a",
+ "reference": "7748a4282df19daf966fda1d8c60a8aec803c83a",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0",
- "php": "^7.2 || ^8.0",
- "phpstan/phpdoc-parser": "^1.23.1",
- "squizlabs/php_codesniffer": "^3.9.0"
+ "php": "^7.4 || ^8.0",
+ "phpstan/phpdoc-parser": "^2.1.0",
+ "squizlabs/php_codesniffer": "^3.11.3"
},
"require-dev": {
- "phing/phing": "2.17.4",
- "php-parallel-lint/php-parallel-lint": "1.3.2",
- "phpstan/phpstan": "1.10.60",
- "phpstan/phpstan-deprecation-rules": "1.1.4",
- "phpstan/phpstan-phpunit": "1.3.16",
- "phpstan/phpstan-strict-rules": "1.5.2",
- "phpunit/phpunit": "8.5.21|9.6.8|10.5.11"
+ "phing/phing": "3.0.1",
+ "php-parallel-lint/php-parallel-lint": "1.4.0",
+ "phpstan/phpstan": "2.1.6",
+ "phpstan/phpstan-deprecation-rules": "2.0.1",
+ "phpstan/phpstan-phpunit": "2.0.4",
+ "phpstan/phpstan-strict-rules": "2.0.3",
+ "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.9|12.0.4"
},
"type": "phpcodesniffer-standard",
"extra": {
@@ -6034,7 +6047,7 @@
],
"support": {
"issues": "https://github.com/slevomat/coding-standard/issues",
- "source": "https://github.com/slevomat/coding-standard/tree/8.15.0"
+ "source": "https://github.com/slevomat/coding-standard/tree/8.16.0"
},
"funding": [
{
@@ -6046,7 +6059,7 @@
"type": "tidelift"
}
],
- "time": "2024-03-09T15:20:58+00:00"
+ "time": "2025-02-23T18:12:49+00:00"
},
{
"name": "spatie/array-to-xml",
@@ -6277,16 +6290,16 @@
},
{
"name": "symfony/dependency-injection",
- "version": "v6.4.16",
+ "version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
- "reference": "7a379d8871f6a36f01559c14e11141cc02eb8dc8"
+ "reference": "b343c3b2f1539fe41331657b37d5c96c1d1ea842"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/7a379d8871f6a36f01559c14e11141cc02eb8dc8",
- "reference": "7a379d8871f6a36f01559c14e11141cc02eb8dc8",
+ "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b343c3b2f1539fe41331657b37d5c96c1d1ea842",
+ "reference": "b343c3b2f1539fe41331657b37d5c96c1d1ea842",
"shasum": ""
},
"require": {
@@ -6338,7 +6351,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/dependency-injection/tree/v6.4.16"
+ "source": "https://github.com/symfony/dependency-injection/tree/v6.4.19"
},
"funding": [
{
@@ -6354,7 +6367,7 @@
"type": "tidelift"
}
],
- "time": "2024-11-25T14:52:46+00:00"
+ "time": "2025-02-20T10:02:49+00:00"
},
{
"name": "symfony/event-dispatcher",
@@ -6512,18 +6525,94 @@
],
"time": "2024-09-25T14:20:29+00:00"
},
+ {
+ "name": "symfony/polyfill-php84",
+ "version": "v1.31.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php84.git",
+ "reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/e5493eb51311ab0b1cc2243416613f06ed8f18bd",
+ "reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2"
+ },
+ "type": "library",
+ "extra": {
+ "thanks": {
+ "url": "https://github.com/symfony/polyfill",
+ "name": "symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Php84\\": ""
+ },
+ "classmap": [
+ "Resources/stubs"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-php84/tree/v1.31.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-09-09T12:04:04+00:00"
+ },
{
"name": "symfony/translation",
- "version": "v6.4.13",
+ "version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
- "reference": "bee9bfabfa8b4045a66bf82520e492cddbaffa66"
+ "reference": "3b9bf9f33997c064885a7bfc126c14b9daa0e00e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/translation/zipball/bee9bfabfa8b4045a66bf82520e492cddbaffa66",
- "reference": "bee9bfabfa8b4045a66bf82520e492cddbaffa66",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/3b9bf9f33997c064885a7bfc126c14b9daa0e00e",
+ "reference": "3b9bf9f33997c064885a7bfc126c14b9daa0e00e",
"shasum": ""
},
"require": {
@@ -6589,7 +6678,7 @@
"description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/translation/tree/v6.4.13"
+ "source": "https://github.com/symfony/translation/tree/v6.4.19"
},
"funding": [
{
@@ -6605,7 +6694,7 @@
"type": "tidelift"
}
],
- "time": "2024-09-27T18:14:25+00:00"
+ "time": "2025-02-13T10:18:43+00:00"
},
{
"name": "symfony/translation-contracts",
@@ -6687,16 +6776,16 @@
},
{
"name": "symfony/var-exporter",
- "version": "v6.4.13",
+ "version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-exporter.git",
- "reference": "0f605f72a363f8743001038a176eeb2a11223b51"
+ "reference": "be6e71b0c257884c1107313de5d247741cfea172"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/var-exporter/zipball/0f605f72a363f8743001038a176eeb2a11223b51",
- "reference": "0f605f72a363f8743001038a176eeb2a11223b51",
+ "url": "https://api.github.com/repos/symfony/var-exporter/zipball/be6e71b0c257884c1107313de5d247741cfea172",
+ "reference": "be6e71b0c257884c1107313de5d247741cfea172",
"shasum": ""
},
"require": {
@@ -6744,7 +6833,7 @@
"serialize"
],
"support": {
- "source": "https://github.com/symfony/var-exporter/tree/v6.4.13"
+ "source": "https://github.com/symfony/var-exporter/tree/v6.4.19"
},
"funding": [
{
@@ -6760,7 +6849,7 @@
"type": "tidelift"
}
],
- "time": "2024-09-25T14:18:03+00:00"
+ "time": "2025-02-13T09:33:32+00:00"
},
{
"name": "symfony/yaml",
@@ -6886,16 +6975,16 @@
},
{
"name": "vimeo/psalm",
- "version": "6.3.0",
+ "version": "6.8.8",
"source": {
"type": "git",
"url": "https://github.com/vimeo/psalm.git",
- "reference": "222dda8483516044c2ed7a4c3f197d7c9d6c3ddb"
+ "reference": "1361cd33008feb3ae2b4a93f1860e14e538ec8c2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/vimeo/psalm/zipball/222dda8483516044c2ed7a4c3f197d7c9d6c3ddb",
- "reference": "222dda8483516044c2ed7a4c3f197d7c9d6c3ddb",
+ "url": "https://api.github.com/repos/vimeo/psalm/zipball/1361cd33008feb3ae2b4a93f1860e14e538ec8c2",
+ "reference": "1361cd33008feb3ae2b4a93f1860e14e538ec8c2",
"shasum": ""
},
"require": {
@@ -6905,6 +6994,7 @@
"composer-runtime-api": "^2",
"composer/semver": "^1.4 || ^2.0 || ^3.0",
"composer/xdebug-handler": "^2.0 || ^3.0",
+ "danog/advanced-json-rpc": "^3.1",
"dnoegel/php-xdg-base-dir": "^0.1.1",
"ext-ctype": "*",
"ext-dom": "*",
@@ -6913,16 +7003,16 @@
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-tokenizer": "*",
- "felixfbecker/advanced-json-rpc": "^3.1",
"felixfbecker/language-server-protocol": "^1.5.3",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0",
- "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
+ "netresearch/jsonmapper": "^5.0",
"nikic/php-parser": "^5.0.0",
- "php": "~8.1.17 || ~8.2.4 || ~8.3.0 || ~8.4.0",
- "sebastian/diff": "^4.0 || ^5.0 || ^6.0",
+ "php": "~8.1.31 || ~8.2.27 || ~8.3.16 || ~8.4.3",
+ "sebastian/diff": "^4.0 || ^5.0 || ^6.0 || ^7.0",
"spatie/array-to-xml": "^2.17.0 || ^3.0",
"symfony/console": "^6.0 || ^7.0",
- "symfony/filesystem": "^6.0 || ^7.0"
+ "symfony/filesystem": "~6.3.12 || ~6.4.3 || ^7.0.3",
+ "symfony/polyfill-php84": "*"
},
"provide": {
"psalm/psalm": "self.version"
@@ -6931,6 +7021,7 @@
"amphp/phpunit-util": "^3",
"bamarni/composer-bin-plugin": "^1.4",
"brianium/paratest": "^6.9",
+ "danog/class-finder": "^0.4.8",
"dg/bypass-finals": "^1.5",
"ext-curl": "*",
"mockery/mockery": "^1.5",
@@ -6998,18 +7089,18 @@
"issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm"
},
- "time": "2025-02-04T16:20:17+00:00"
+ "time": "2025-02-25T17:34:39+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": [],
+ "stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "8.1.*||8.2.*||8.3.*||8.4.*"
},
- "platform-dev": [],
+ "platform-dev": {},
"platform-overrides": {
"php": "8.1.99"
},
diff --git a/docs/extension-maintainers.md b/docs/extension-maintainers.md
index 610728bd..7f34de30 100644
--- a/docs/extension-maintainers.md
+++ b/docs/extension-maintainers.md
@@ -160,6 +160,26 @@ should specify this path in `build-path`, for example:
}
```
+The `build-path` may contain some templated values which are replaced:
+
+ * `{version}` to be replaced with the package version. For example a package
+ with version 1.2.3 with a `build-path` of `myext-{version}` the actual build
+ path would become `myext-1.2.3`.
+
+#### `download-url-method`
+
+The `download-url-method` directive allows extension maintainers to
+change the behaviour of downloading the source package.
+
+ * Setting this to `composer-default`, which is the default value if not
+ specified, will use the default behaviour implemented by Composer, which is
+ to use the standard ZIP archive from the GitHub API (or other source control
+ system).
+ * Using `pre-packaged-source` will locate a source code package in the release
+ assets list based matching one of the following naming conventions:
+ * `php_{ExtensionName}-{Version}-src.tgz` (e.g. `php_myext-1.20.1-src.tgz`)
+ * `php_{ExtensionName}-{Version}-src.zip` (e.g. `php_myext-1.20.1-src.zip`)
+
### Extension dependencies
Extension authors may define some dependencies in `require`, but practically,
diff --git a/psalm.xml.dist b/psalm.xml.dist
index dee1f3f1..aaafabfc 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -23,6 +23,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/composer-json-php-ext-schema.json b/resources/composer-json-php-ext-schema.json
new file mode 100644
index 00000000..ca283510
--- /dev/null
+++ b/resources/composer-json-php-ext-schema.json
@@ -0,0 +1,106 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://raw.githubusercontent.com/php/pie/main/composer-json-php-ext-schema.json",
+ "title": "composer.json php-ext schema",
+ "description": "Schema for the proposed php-ext section in composer.json that the new PECL will use to build packages",
+ "type": "object",
+ "properties": {
+ "php-ext": {
+ "type": "object",
+ "description": "Settings for PHP extension packages.",
+ "properties": {
+ "extension-name": {
+ "type": "string",
+ "description": "If specified, this will be used as the name of the extension, where needed by tooling. If this is not specified, the extension name will be derived from the Composer package name (e.g. `vendor/name` would become `ext-name`). The extension name may be specified with or without the `ext-` prefix, and tools that use this must normalise this appropriately.",
+ "example": "ext-xdebug"
+ },
+ "priority": {
+ "type": "integer",
+ "description": "This is used to add a prefix to the INI file, e.g. `90-xdebug.ini` which affects the loading order. The priority is a number in the range 10-99 inclusive, with 10 being the highest priority (i.e. will be processed first), and 99 being the lowest priority (i.e. will be processed last). There are two digits so that the files sort correctly on any platform, whether the sorting is natural or not.",
+ "minimum": 10,
+ "maximum": 99,
+ "example": 80,
+ "default": 80
+ },
+ "support-zts": {
+ "type": "boolean",
+ "description": "Does this package support Zend Thread Safety",
+ "example": false,
+ "default": true
+ },
+ "support-nts": {
+ "type": "boolean",
+ "description": "Does this package support non-Thread Safe mode",
+ "example": false,
+ "default": true
+ },
+ "build-path": {
+ "type": ["string", "null"],
+ "description": "If specified, this is the subdirectory that will be used to build the extension instead of the root of the project.",
+ "example": "my-extension-source",
+ "default": null
+ },
+ "download-url-method": {
+ "type": "string",
+ "description": "If specified, this technique will be used to override the URL that PIE uses to download the asset. The default, if not specified, is composer-default.",
+ "enum": ["composer-default", "pre-packaged-source"],
+ "example": "composer-default"
+ },
+ "os-families": {
+ "type": "array",
+ "minItems": 1,
+ "description": "An array of OS families to mark as compatible with the extension. Specifying this property will mean this package is not installable with PIE on any OS family not listed here. Must not be specified alongside os-families-exclude.",
+ "items": {
+ "type": "string",
+ "enum": ["windows", "bsd", "darwin", "solaris", "linux", "unknown"],
+ "description": "The name of the OS family to mark as compatible."
+ }
+ },
+ "os-families-exclude": {
+ "type": "array",
+ "minItems": 1,
+ "description": "An array of OS families to mark as incompatible with the extension. Specifying this property will mean this package is installable on any OS family except those listed here. Must not be specified alongside os-families.",
+ "items": {
+ "type": "string",
+ "enum": ["windows", "bsd", "darwin", "solaris", "linux", "unknown"],
+ "description": "The name of the OS family to exclude."
+ }
+ },
+ "configure-options": {
+ "type": "array",
+ "description": "These configure options make up the flags that can be passed to ./configure when installing the extension.",
+ "items": {
+ "type": "object",
+ "required": ["name"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name of the flag, this would typically be prefixed with `--`, for example, the value 'the-flag' would be passed as `./configure --the-flag`.",
+ "example": "without-xdebug-compression",
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-_]*$"
+ },
+ "needs-value": {
+ "type": "boolean",
+ "description": "If this is set to true, the flag needs a value (e.g. --with-somelib=), otherwise it is a flag without a value (e.g. --enable-some-feature).",
+ "example": false,
+ "default": false
+ },
+ "description": {
+ "type": "string",
+ "description": "The description of what the flag does or means.",
+ "example": "Disable compression through zlib"
+ }
+ }
+ }
+ }
+ },
+ "allOf": [
+ {
+ "not": {
+ "required": ["os-families", "os-families-exclude"]
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/src/Building/UnixBuild.php b/src/Building/UnixBuild.php
index 6e7c9942..3130407d 100644
--- a/src/Building/UnixBuild.php
+++ b/src/Building/UnixBuild.php
@@ -76,7 +76,7 @@ public function __invoke(
$this->make($targetPlatform, $downloadedPackage, $output, $outputCallback);
- $expectedSoFile = $downloadedPackage->extractedSourcePath . '/modules/' . $downloadedPackage->package->extensionName->name() . '.so';
+ $expectedSoFile = $downloadedPackage->extractedSourcePath . '/modules/' . $downloadedPackage->package->extensionName()->name() . '.so';
if (! file_exists($expectedSoFile)) {
throw ExtensionBinaryNotFound::fromExpectedBinary($expectedSoFile);
diff --git a/src/Command/BuildCommand.php b/src/Command/BuildCommand.php
index 09983648..b118d682 100644
--- a/src/Command/BuildCommand.php
+++ b/src/Command/BuildCommand.php
@@ -64,7 +64,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$requestedNameAndVersion,
$forceInstallPackageVersion,
);
- $output->writeln(sprintf('Found package: %s which provides %s', $package->prettyNameAndVersion(), $package->extensionName->nameWithExtPrefix()));
+ $output->writeln(sprintf('Found package: %s which provides %s', $package->prettyNameAndVersion(), $package->extensionName()->nameWithExtPrefix()));
// Now we know what package we have, we can validate the configure options for the command and re-create the
// Composer instance with the populated configure options
diff --git a/src/Command/CommandHelper.php b/src/Command/CommandHelper.php
index 1fc4c7a9..8614fd2f 100644
--- a/src/Command/CommandHelper.php
+++ b/src/Command/CommandHelper.php
@@ -226,7 +226,7 @@ public static function requestedNameAndVersionPair(InputInterface $input): Reque
public static function bindConfigureOptionsFromPackage(Command $command, Package $package, InputInterface $input): void
{
- foreach ($package->configureOptions as $configureOption) {
+ foreach ($package->configureOptions() as $configureOption) {
$command->addOption(
$configureOption->name,
null,
@@ -242,7 +242,7 @@ public static function bindConfigureOptionsFromPackage(Command $command, Package
public static function processConfigureOptionsFromInput(Package $package, InputInterface $input): array
{
$configureOptionsValues = [];
- foreach ($package->configureOptions as $configureOption) {
+ foreach ($package->configureOptions() as $configureOption) {
if (! $input->hasOption($configureOption->name)) {
continue;
}
diff --git a/src/Command/DownloadCommand.php b/src/Command/DownloadCommand.php
index 4a7439b1..7d27adde 100644
--- a/src/Command/DownloadCommand.php
+++ b/src/Command/DownloadCommand.php
@@ -66,7 +66,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$requestedNameAndVersion,
$forceInstallPackageVersion,
);
- $output->writeln(sprintf('Found package: %s which provides %s', $package->prettyNameAndVersion(), $package->extensionName->nameWithExtPrefix()));
+ $output->writeln(sprintf('Found package: %s which provides %s', $package->prettyNameAndVersion(), $package->extensionName()->nameWithExtPrefix()));
try {
($this->composerIntegrationHandler)(
diff --git a/src/Command/InfoCommand.php b/src/Command/InfoCommand.php
index 0d03e934..4cb56949 100644
--- a/src/Command/InfoCommand.php
+++ b/src/Command/InfoCommand.php
@@ -64,17 +64,17 @@ public function execute(InputInterface $input, OutputInterface $output): int
$requestedNameAndVersion,
CommandHelper::determineForceInstallingPackageVersion($input),
);
- $output->writeln(sprintf('Found package: %s which provides %s', $package->prettyNameAndVersion(), $package->extensionName->nameWithExtPrefix()));
+ $output->writeln(sprintf('Found package: %s which provides %s', $package->prettyNameAndVersion(), $package->extensionName()->nameWithExtPrefix()));
- $output->writeln(sprintf('Extension name: %s', $package->extensionName->name()));
- $output->writeln(sprintf('Extension type: %s (%s)', $package->extensionType->value, $package->extensionType->name));
- $output->writeln(sprintf('Composer package name: %s', $package->name));
- $output->writeln(sprintf('Version: %s', $package->version));
- $output->writeln(sprintf('Download URL: %s', $package->downloadUrl ?? '(not specified)'));
+ $output->writeln(sprintf('Extension name: %s', $package->extensionName()->name()));
+ $output->writeln(sprintf('Extension type: %s (%s)', $package->extensionType()->value, $package->extensionType()->name));
+ $output->writeln(sprintf('Composer package name: %s', $package->name()));
+ $output->writeln(sprintf('Version: %s', $package->version()));
+ $output->writeln(sprintf('Download URL: %s', $package->downloadUrl() ?? '(not specified)'));
- if (count($package->configureOptions)) {
+ if (count($package->configureOptions())) {
$output->writeln('Configure options:');
- foreach ($package->configureOptions as $configureOption) {
+ foreach ($package->configureOptions() as $configureOption) {
$output->writeln(sprintf(' --%s%s (%s)', $configureOption->name, $configureOption->needsValue ? '=?' : '', $configureOption->description));
}
} else {
diff --git a/src/Command/InstallCommand.php b/src/Command/InstallCommand.php
index 0640b5e4..068f3c36 100644
--- a/src/Command/InstallCommand.php
+++ b/src/Command/InstallCommand.php
@@ -69,7 +69,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$requestedNameAndVersion,
$forceInstallPackageVersion,
);
- $output->writeln(sprintf('Found package: %s which provides %s', $package->prettyNameAndVersion(), $package->extensionName->nameWithExtPrefix()));
+ $output->writeln(sprintf('Found package: %s which provides %s', $package->prettyNameAndVersion(), $package->extensionName()->nameWithExtPrefix()));
// Now we know what package we have, we can validate the configure options for the command and re-create the
// Composer instance with the populated configure options
diff --git a/src/Command/ShowCommand.php b/src/Command/ShowCommand.php
index cb750f11..2c07282d 100644
--- a/src/Command/ShowCommand.php
+++ b/src/Command/ShowCommand.php
@@ -80,7 +80,7 @@ static function (string $version, string $phpExtensionName) use ($output, $piePa
$extensionPath,
$phpExtensionName,
$extensionEnding,
- PieInstalledJsonMetadataKeys::pieMetadataFromComposerPackage($piePackage->composerPackage),
+ PieInstalledJsonMetadataKeys::pieMetadataFromComposerPackage($piePackage->composerPackage()),
),
));
},
@@ -152,7 +152,7 @@ static function (BasePackage $basePackage): bool {
array_map(
/** @return non-empty-string */
static function (Package $package): string {
- return $package->extensionName->name();
+ return $package->extensionName()->name();
},
$composerInstalledPackages,
),
diff --git a/src/ComposerIntegration/ComposerIntegrationHandler.php b/src/ComposerIntegration/ComposerIntegrationHandler.php
index 48d93aa8..d9b8f7b2 100644
--- a/src/ComposerIntegration/ComposerIntegrationHandler.php
+++ b/src/ComposerIntegration/ComposerIntegrationHandler.php
@@ -39,7 +39,7 @@ public function __invoke(
// If user did not request a specific require version, use Composer to recommend one for the pie.json
if ($recommendedRequireVersion === null) {
- $recommendedRequireVersion = $versionSelector->findRecommendedRequireVersion($package->composerPackage);
+ $recommendedRequireVersion = $versionSelector->findRecommendedRequireVersion($package->composerPackage());
}
// Write the new requirement to pie.json; because we later essentially just do a `composer install` using that file
@@ -60,7 +60,7 @@ public function __invoke(
$composerInstaller = PieComposerInstaller::createWithPhpBinary(
$targetPlatform->phpBinaryPath,
- $package->extensionName,
+ $package->extensionName(),
$this->arrayCollectionIo,
$composer,
);
diff --git a/src/ComposerIntegration/Listeners/OverrideDownloadUrlInstallListener.php b/src/ComposerIntegration/Listeners/OverrideDownloadUrlInstallListener.php
new file mode 100644
index 00000000..fc8a6cdc
--- /dev/null
+++ b/src/ComposerIntegration/Listeners/OverrideDownloadUrlInstallListener.php
@@ -0,0 +1,110 @@
+getEventDispatcher()
+ ->addListener(
+ InstallerEvents::PRE_OPERATIONS_EXEC,
+ new self($composer, $io, $container, $composerRequest),
+ );
+ }
+
+ public function __invoke(InstallerEvent $installerEvent): void
+ {
+ /** @psalm-suppress InternalMethod */
+ $operations = $installerEvent->getTransaction()?->getOperations() ?? [];
+
+ array_walk(
+ $operations,
+ function (OperationInterface $operation): void {
+ if (! $operation instanceof InstallOperation) {
+ return;
+ }
+
+ $composerPackage = $operation->getPackage();
+ if (! $composerPackage instanceof CompletePackageInterface) {
+ return;
+ }
+
+ // Install requests for other packages than the one we want should be ignored
+ if ($this->composerRequest->requestedPackage->package !== $composerPackage->getName()) {
+ return;
+ }
+
+ $piePackage = Package::fromComposerCompletePackage($composerPackage);
+ $targetPlatform = $this->composerRequest->targetPlatform;
+ $downloadUrlMethod = DownloadUrlMethod::fromPackage($piePackage, $targetPlatform);
+
+ // Exit early if we should just use Composer's normal download
+ if ($downloadUrlMethod === DownloadUrlMethod::ComposerDefaultDownload) {
+ return;
+ }
+
+ $possibleAssetNames = $downloadUrlMethod->possibleAssetNames($piePackage, $targetPlatform);
+ if ($possibleAssetNames === null) {
+ return;
+ }
+
+ // @todo https://github.com/php/pie/issues/138 will need to depend on the repo type (GH/GL/BB/etc.)
+ $packageReleaseAssets = $this->container->get(PackageReleaseAssets::class);
+
+ $url = $packageReleaseAssets->findMatchingReleaseAssetUrl(
+ $targetPlatform,
+ $piePackage,
+ new AuthHelper($this->io, $this->composer->getConfig()),
+ new HttpDownloader($this->io, $this->composer->getConfig()),
+ $possibleAssetNames,
+ );
+
+ $this->composerRequest->pieOutput->writeln('Found prebuilt archive: ' . $url);
+ $composerPackage->setDistUrl($url);
+
+ if (pathinfo($url, PATHINFO_EXTENSION) !== 'tgz') {
+ return;
+ }
+
+ $composerPackage->setDistType('tar');
+ },
+ );
+ }
+}
diff --git a/src/ComposerIntegration/RemoveUnrelatedInstallOperations.php b/src/ComposerIntegration/Listeners/RemoveUnrelatedInstallOperations.php
similarity index 96%
rename from src/ComposerIntegration/RemoveUnrelatedInstallOperations.php
rename to src/ComposerIntegration/Listeners/RemoveUnrelatedInstallOperations.php
index 874ce7ee..eb7a8a44 100644
--- a/src/ComposerIntegration/RemoveUnrelatedInstallOperations.php
+++ b/src/ComposerIntegration/Listeners/RemoveUnrelatedInstallOperations.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Php\Pie\ComposerIntegration;
+namespace Php\Pie\ComposerIntegration\Listeners;
use Closure;
use Composer\Composer;
@@ -11,6 +11,7 @@
use Composer\DependencyResolver\Transaction;
use Composer\Installer\InstallerEvent;
use Composer\Installer\InstallerEvents;
+use Php\Pie\ComposerIntegration\PieComposerRequest;
use Symfony\Component\Console\Output\OutputInterface;
use function array_filter;
diff --git a/src/ComposerIntegration/OverrideWindowsUrlInstallListener.php b/src/ComposerIntegration/OverrideWindowsUrlInstallListener.php
deleted file mode 100644
index 43e064a3..00000000
--- a/src/ComposerIntegration/OverrideWindowsUrlInstallListener.php
+++ /dev/null
@@ -1,75 +0,0 @@
-getEventDispatcher()
- ->addListener(
- InstallerEvents::PRE_OPERATIONS_EXEC,
- new self($composer, $io, $container, $composerRequest),
- );
- }
-
- public function __invoke(InstallerEvent $installerEvent): void
- {
- if ($this->composerRequest->targetPlatform->operatingSystem !== OperatingSystem::Windows) {
- return;
- }
-
- /** @psalm-suppress InternalMethod */
- $operations = $installerEvent->getTransaction()?->getOperations() ?? [];
-
- Assert::count($operations, 1, 'I can only do exactly %d thing at once, %d attempted');
- $operation = reset($operations);
- Assert::isInstanceOf($operation, InstallOperation::class, 'I can only handle %2$s, got %s');
-
- $composerPackage = $operation->getPackage();
- Assert::isInstanceOf($composerPackage, CompletePackageInterface::class, 'I can only handle %2$s, got %s');
-
- $packageReleaseAssets = $this->container->get(PackageReleaseAssets::class);
- $url = $packageReleaseAssets->findWindowsDownloadUrlForPackage(
- $this->composerRequest->targetPlatform,
- Package::fromComposerCompletePackage($composerPackage),
- new AuthHelper($this->io, $this->composer->getConfig()),
- new HttpDownloader($this->io, $this->composer->getConfig()),
- );
-
- $this->composerRequest->pieOutput->writeln('Found prebuilt archive: ' . $url);
- $composerPackage->setDistUrl($url);
- }
-}
diff --git a/src/ComposerIntegration/PieComposerFactory.php b/src/ComposerIntegration/PieComposerFactory.php
index 279348df..7acb2352 100644
--- a/src/ComposerIntegration/PieComposerFactory.php
+++ b/src/ComposerIntegration/PieComposerFactory.php
@@ -11,6 +11,8 @@
use Composer\PartialComposer;
use Composer\Util\Filesystem;
use Composer\Util\ProcessExecutor;
+use Php\Pie\ComposerIntegration\Listeners\OverrideDownloadUrlInstallListener;
+use Php\Pie\ComposerIntegration\Listeners\RemoveUnrelatedInstallOperations;
use Php\Pie\ExtensionType;
use Php\Pie\Platform;
use Psr\Container\ContainerInterface;
@@ -59,7 +61,7 @@ public static function createPieComposer(
true,
);
- OverrideWindowsUrlInstallListener::selfRegister($composer, $io, $container, $composerRequest);
+ OverrideDownloadUrlInstallListener::selfRegister($composer, $io, $container, $composerRequest);
RemoveUnrelatedInstallOperations::selfRegister($composer, $composerRequest);
$composer->getConfig()->merge(['config' => ['__PIE_REQUEST__' => $composerRequest]]);
diff --git a/src/DependencyResolver/Package.php b/src/DependencyResolver/Package.php
index d09a8a0d..2e4d31e8 100644
--- a/src/DependencyResolver/Package.php
+++ b/src/DependencyResolver/Package.php
@@ -7,6 +7,7 @@
use Composer\Package\CompletePackageInterface;
use InvalidArgumentException;
use Php\Pie\ConfigureOption;
+use Php\Pie\Downloading\DownloadUrlMethod;
use Php\Pie\ExtensionName;
use Php\Pie\ExtensionType;
use Php\Pie\Platform\OperatingSystemFamily;
@@ -26,53 +27,56 @@
* @internal This is not public API for PIE, so should not be depended upon unless you accept the risk of BC breaks
*
* @immutable
+ *
+ * @psalm-suppress PropertyNotSetInConstructor
*/
final class Package
{
- /**
- * @param list $configureOptions
- * @param non-empty-list|null $compatibleOsFamilies
- * @param non-empty-list|null $incompatibleOsFamilies
- */
+ /** @var list */
+ private array $configureOptions = [];
+ private int $priority = 80;
+ private string|null $buildPath = null;
+ /** @var non-empty-list|null */
+ private array|null $compatibleOsFamilies = null;
+ /** @var non-empty-list|null */
+ private array|null $incompatibleOsFamilies = null;
+ private bool $supportZts = true;
+ private bool $supportNts = true;
+ private DownloadUrlMethod|null $downloadUrlMethod = null;
+
public function __construct(
- public readonly CompletePackageInterface $composerPackage,
- public readonly ExtensionType $extensionType,
- public readonly ExtensionName $extensionName,
- public readonly string $name,
- public readonly string $version,
- public readonly string|null $downloadUrl,
- public readonly array $configureOptions,
- public readonly bool $supportZts,
- public readonly bool $supportNts,
- public readonly string|null $buildPath,
- public readonly array|null $compatibleOsFamilies,
- public readonly array|null $incompatibleOsFamilies,
- public readonly int $priority,
+ private readonly CompletePackageInterface $composerPackage,
+ private readonly ExtensionType $extensionType,
+ private readonly ExtensionName $extensionName,
+ private readonly string $name,
+ private readonly string $version,
+ private readonly string|null $downloadUrl,
) {
}
public static function fromComposerCompletePackage(CompletePackageInterface $completePackage): self
{
+ $package = new self(
+ $completePackage,
+ ExtensionType::tryFrom($completePackage->getType()) ?? ExtensionType::PhpModule,
+ ExtensionName::determineFromComposerPackage($completePackage),
+ $completePackage->getPrettyName(),
+ $completePackage->getPrettyVersion(),
+ $completePackage->getDistUrl(),
+ );
+
$phpExtOptions = $completePackage->getPhpExt();
- $configureOptions = $phpExtOptions !== null && array_key_exists('configure-options', $phpExtOptions)
+ $package->configureOptions = $phpExtOptions !== null && array_key_exists('configure-options', $phpExtOptions)
? array_map(
static fn (array $configureOption): ConfigureOption => ConfigureOption::fromComposerJsonDefinition($configureOption),
$phpExtOptions['configure-options'],
)
: [];
- $supportZts = $phpExtOptions !== null && array_key_exists('support-zts', $phpExtOptions)
- ? $phpExtOptions['support-zts']
- : true;
-
- $supportNts = $phpExtOptions !== null && array_key_exists('support-nts', $phpExtOptions)
- ? $phpExtOptions['support-nts']
- : true;
-
- $buildPath = $phpExtOptions !== null && array_key_exists('build-path', $phpExtOptions)
- ? $phpExtOptions['build-path']
- : null;
+ $package->supportZts = $phpExtOptions['support-zts'] ?? true;
+ $package->supportNts = $phpExtOptions['support-nts'] ?? true;
+ $package->buildPath = $phpExtOptions['build-path'] ?? null;
$compatibleOsFamilies = $phpExtOptions['os-families'] ?? null;
$incompatibleOsFamilies = $phpExtOptions['os-families-exclude'] ?? null;
@@ -81,21 +85,16 @@ public static function fromComposerCompletePackage(CompletePackageInterface $com
throw new InvalidArgumentException('Cannot specify both "os-families" and "os-families-exclude" in composer.json');
}
- return new self(
- $completePackage,
- ExtensionType::tryFrom($completePackage->getType()) ?? ExtensionType::PhpModule,
- ExtensionName::determineFromComposerPackage($completePackage),
- $completePackage->getPrettyName(),
- $completePackage->getPrettyVersion(),
- $completePackage->getDistUrl(),
- $configureOptions,
- $supportZts,
- $supportNts,
- $buildPath,
- self::convertInputStringsToOperatingSystemFamilies($compatibleOsFamilies),
- self::convertInputStringsToOperatingSystemFamilies($incompatibleOsFamilies),
- $phpExtOptions['priority'] ?? 80,
- );
+ $package->compatibleOsFamilies = self::convertInputStringsToOperatingSystemFamilies($compatibleOsFamilies);
+ $package->incompatibleOsFamilies = self::convertInputStringsToOperatingSystemFamilies($incompatibleOsFamilies);
+
+ $package->priority = $phpExtOptions['priority'] ?? 80;
+
+ if ($phpExtOptions !== null && array_key_exists('download-url-method', $phpExtOptions)) {
+ $package->downloadUrlMethod = DownloadUrlMethod::tryFrom($phpExtOptions['download-url-method']);
+ }
+
+ return $package;
}
public function prettyNameAndVersion(): string
@@ -133,17 +132,92 @@ private static function convertInputStringsToOperatingSystemFamilies(array|null
return null;
}
- $osFamilies = [];
- foreach ($input as $value) {
- $valueToTry = strtolower($value);
+ Assert::isNonEmptyList($input, 'Expected operating systems families to be a non-empty list.');
- Assert::inArray($valueToTry, OperatingSystemFamily::asValuesList(), 'Expected operating system family to be one of: %2$s. Got: %s');
+ return array_map(
+ static function ($value): OperatingSystemFamily {
+ Assert::inArray(
+ strtolower($value),
+ OperatingSystemFamily::asValuesList(),
+ 'Expected operating system family to be one of: %2$s. Got: %s',
+ );
- $osFamilies[] = OperatingSystemFamily::from($valueToTry);
- }
+ return OperatingSystemFamily::from(strtolower($value));
+ },
+ $input,
+ );
+ }
+
+ public function composerPackage(): CompletePackageInterface
+ {
+ return $this->composerPackage;
+ }
- Assert::isNonEmptyList($osFamilies, 'Expected operating systems families to be a non-empty list.');
+ public function extensionType(): ExtensionType
+ {
+ return $this->extensionType;
+ }
- return $osFamilies;
+ public function extensionName(): ExtensionName
+ {
+ return $this->extensionName;
+ }
+
+ public function name(): string
+ {
+ return $this->name;
+ }
+
+ public function version(): string
+ {
+ return $this->version;
+ }
+
+ /** @return list */
+ public function configureOptions(): array
+ {
+ return $this->configureOptions;
+ }
+
+ public function downloadUrl(): string|null
+ {
+ return $this->downloadUrl;
+ }
+
+ public function priority(): int
+ {
+ return $this->priority;
+ }
+
+ public function buildPath(): string|null
+ {
+ return $this->buildPath;
+ }
+
+ /** @return non-empty-list|null */
+ public function compatibleOsFamilies(): array|null
+ {
+ return $this->compatibleOsFamilies;
+ }
+
+ /** @return non-empty-list|null */
+ public function incompatibleOsFamilies(): array|null
+ {
+ return $this->incompatibleOsFamilies;
+ }
+
+ public function supportZts(): bool
+ {
+ return $this->supportZts;
+ }
+
+ public function supportNts(): bool
+ {
+ return $this->supportNts;
+ }
+
+ public function downloadUrlMethod(): DownloadUrlMethod|null
+ {
+ return $this->downloadUrlMethod;
}
}
diff --git a/src/DependencyResolver/ResolveDependencyWithComposer.php b/src/DependencyResolver/ResolveDependencyWithComposer.php
index d2bdbd28..9e4fe603 100644
--- a/src/DependencyResolver/ResolveDependencyWithComposer.php
+++ b/src/DependencyResolver/ResolveDependencyWithComposer.php
@@ -70,27 +70,27 @@ public function __invoke(
private function assertCompatibleThreadSafetyMode(ThreadSafetyMode $threadSafetyMode, Package $resolvedPackage): void
{
- if ($threadSafetyMode === ThreadSafetyMode::NonThreadSafe && ! $resolvedPackage->supportNts) {
+ if ($threadSafetyMode === ThreadSafetyMode::NonThreadSafe && ! $resolvedPackage->supportNts()) {
throw IncompatibleThreadSafetyMode::ztsExtensionOnNtsPlatform();
}
- if ($threadSafetyMode === ThreadSafetyMode::ThreadSafe && ! $resolvedPackage->supportZts) {
+ if ($threadSafetyMode === ThreadSafetyMode::ThreadSafe && ! $resolvedPackage->supportZts()) {
throw IncompatibleThreadSafetyMode::ntsExtensionOnZtsPlatform();
}
}
private function assertCompatibleOsFamily(TargetPlatform $targetPlatform, Package $resolvedPackage): void
{
- if ($resolvedPackage->compatibleOsFamilies !== null && ! in_array($targetPlatform->operatingSystemFamily, $resolvedPackage->compatibleOsFamilies, true)) {
+ if ($resolvedPackage->compatibleOsFamilies() !== null && ! in_array($targetPlatform->operatingSystemFamily, $resolvedPackage->compatibleOsFamilies(), true)) {
throw IncompatibleOperatingSystemFamily::notInCompatibleOperatingSystemFamilies(
- $resolvedPackage->compatibleOsFamilies,
+ $resolvedPackage->compatibleOsFamilies(),
$targetPlatform->operatingSystemFamily,
);
}
- if ($resolvedPackage->incompatibleOsFamilies !== null && in_array($targetPlatform->operatingSystemFamily, $resolvedPackage->incompatibleOsFamilies, true)) {
+ if ($resolvedPackage->incompatibleOsFamilies() !== null && in_array($targetPlatform->operatingSystemFamily, $resolvedPackage->incompatibleOsFamilies(), true)) {
throw IncompatibleOperatingSystemFamily::inIncompatibleOperatingSystemFamily(
- $resolvedPackage->incompatibleOsFamilies,
+ $resolvedPackage->incompatibleOsFamilies(),
$targetPlatform->operatingSystemFamily,
);
}
diff --git a/src/Downloading/DownloadUrlMethod.php b/src/Downloading/DownloadUrlMethod.php
new file mode 100644
index 00000000..397de170
--- /dev/null
+++ b/src/Downloading/DownloadUrlMethod.php
@@ -0,0 +1,50 @@
+|null */
+ public function possibleAssetNames(Package $package, TargetPlatform $targetPlatform): array|null
+ {
+ return match ($this) {
+ self::WindowsBinaryDownload => WindowsExtensionAssetName::zipNames($targetPlatform, $package),
+ self::PrePackagedSourceDownload => PrePackagedSourceAssetName::packageNames($package),
+ self::ComposerDefaultDownload => null,
+ };
+ }
+
+ public static function fromPackage(Package $package, TargetPlatform $targetPlatform): self
+ {
+ /**
+ * PIE does not support building on Windows (yet, at least). Maintainers
+ * should provide pre-built Windows binaries.
+ */
+ if ($targetPlatform->operatingSystem === OperatingSystem::Windows) {
+ return self::WindowsBinaryDownload;
+ }
+
+ /**
+ * Some packages pre-package source code (e.g. mongodb) as there are
+ * external dependencies in Git submodules that otherwise aren't
+ * included in GitHub/Gitlab/etc "dist" downloads
+ */
+ if ($package->downloadUrlMethod() === DownloadUrlMethod::PrePackagedSourceDownload) {
+ return self::PrePackagedSourceDownload;
+ }
+
+ return self::ComposerDefaultDownload;
+ }
+}
diff --git a/src/Downloading/DownloadedPackage.php b/src/Downloading/DownloadedPackage.php
index 3f6adeb8..d23b20a4 100644
--- a/src/Downloading/DownloadedPackage.php
+++ b/src/Downloading/DownloadedPackage.php
@@ -5,11 +5,19 @@
namespace Php\Pie\Downloading;
use Php\Pie\DependencyResolver\Package;
+use Php\Pie\Platform\PrePackagedSourceAssetName;
+use function array_map;
+use function array_unique;
+use function file_exists;
+use function is_dir;
use function is_string;
+use function pathinfo;
use function realpath;
+use function str_replace;
use const DIRECTORY_SEPARATOR;
+use const PATHINFO_FILENAME;
/**
* @internal This is not public API for PIE, so should not be depended upon unless you accept the risk of BC breaks
@@ -24,16 +32,66 @@ private function __construct(
) {
}
- public static function fromPackageAndExtractedPath(Package $package, string $extractedSourcePath): self
+ private static function unfoldUnarchivedSourcePaths(Package $package, string $extractedSourcePath): string
{
- if ($package->buildPath !== null) {
- $extractedSourcePathWithBuildPath = realpath($extractedSourcePath . DIRECTORY_SEPARATOR . $package->buildPath);
+ // There is already something buildable here, don't need to unfold
+ if (
+ file_exists($extractedSourcePath . DIRECTORY_SEPARATOR . 'config.m4')
+ || file_exists($extractedSourcePath . DIRECTORY_SEPARATOR . 'config.w32')
+ ) {
+ return $extractedSourcePath;
+ }
- if (is_string($extractedSourcePathWithBuildPath)) {
- $extractedSourcePath = $extractedSourcePathWithBuildPath;
+ $possibleAssetNames = array_unique(array_map(
+ static fn (string $assetName): string => pathinfo($assetName, PATHINFO_FILENAME),
+ PrePackagedSourceAssetName::packageNames($package),
+ ));
+ foreach ($possibleAssetNames as $possibleAssetName) {
+ if (
+ ! file_exists($extractedSourcePath . DIRECTORY_SEPARATOR . $possibleAssetName)
+ || ! is_dir($extractedSourcePath . DIRECTORY_SEPARATOR . $possibleAssetName)
+ ) {
+ continue;
}
+
+ if (
+ file_exists($extractedSourcePath . DIRECTORY_SEPARATOR . $possibleAssetName . DIRECTORY_SEPARATOR . 'config.m4')
+ || file_exists($extractedSourcePath . DIRECTORY_SEPARATOR . $possibleAssetName . DIRECTORY_SEPARATOR . 'config.w32')
+ ) {
+ return $extractedSourcePath . DIRECTORY_SEPARATOR . $possibleAssetName;
+ }
+ }
+
+ return $extractedSourcePath;
+ }
+
+ private static function overrideSourcePathUsingBuildPath(Package $package, string $extractedSourcePath): string
+ {
+ if ($package->buildPath() === null) {
+ return $extractedSourcePath;
+ }
+
+ $extractedSourcePathWithBuildPath = realpath(
+ $extractedSourcePath
+ . DIRECTORY_SEPARATOR
+ . str_replace('{version}', $package->version(), $package->buildPath()),
+ );
+
+ if (! is_string($extractedSourcePathWithBuildPath)) {
+ return $extractedSourcePath;
+ }
+
+ return $extractedSourcePathWithBuildPath;
+ }
+
+ public static function fromPackageAndExtractedPath(Package $package, string $extractedSourcePath): self
+ {
+ $sourcePath = self::unfoldUnarchivedSourcePaths($package, $extractedSourcePath);
+
+ if ($package->buildPath() !== null) {
+ $sourcePath = self::overrideSourcePathUsingBuildPath($package, $extractedSourcePath);
}
- return new self($package, $extractedSourcePath);
+ return new self($package, $sourcePath);
}
}
diff --git a/src/Downloading/GithubPackageReleaseAssets.php b/src/Downloading/GithubPackageReleaseAssets.php
index 69f338d0..4b526ae0 100644
--- a/src/Downloading/GithubPackageReleaseAssets.php
+++ b/src/Downloading/GithubPackageReleaseAssets.php
@@ -9,7 +9,6 @@
use Composer\Util\HttpDownloader;
use Php\Pie\DependencyResolver\Package;
use Php\Pie\Platform\TargetPlatform;
-use Php\Pie\Platform\WindowsExtensionAssetName;
use Webmozart\Assert\Assert;
use function array_map;
@@ -25,47 +24,48 @@ public function __construct(
) {
}
- /** @return non-empty-string */
- public function findWindowsDownloadUrlForPackage(
+ /**
+ * @param non-empty-list $possibleReleaseAssetNames
+ *
+ * @return non-empty-string
+ */
+ public function findMatchingReleaseAssetUrl(
TargetPlatform $targetPlatform,
Package $package,
AuthHelper $authHelper,
HttpDownloader $httpDownloader,
+ array $possibleReleaseAssetNames,
): string {
$releaseAsset = $this->selectMatchingReleaseAsset(
- $targetPlatform,
$package,
$this->getReleaseAssetsForPackage($package, $authHelper, $httpDownloader),
+ $possibleReleaseAssetNames,
);
return $releaseAsset['browser_download_url'];
}
- /** @return non-empty-list */
- private function expectedWindowsAssetNames(TargetPlatform $targetPlatform, Package $package): array
- {
- return WindowsExtensionAssetName::zipNames($targetPlatform, $package);
- }
-
/** @link https://github.com/squizlabs/PHP_CodeSniffer/issues/3734 */
// phpcs:disable Squiz.Commenting.FunctionComment.MissingParamName
/**
* @param list $releaseAssets
+ * @param non-empty-list $possibleReleaseAssetNames
*
* @return array{name: non-empty-string, browser_download_url: non-empty-string, ...}
*/
// phpcs:enable
- private function selectMatchingReleaseAsset(TargetPlatform $targetPlatform, Package $package, array $releaseAssets): array
- {
- $expectedAssetNames = $this->expectedWindowsAssetNames($targetPlatform, $package);
-
+ private function selectMatchingReleaseAsset(
+ Package $package,
+ array $releaseAssets,
+ array $possibleReleaseAssetNames,
+ ): array {
foreach ($releaseAssets as $releaseAsset) {
- if (in_array(strtolower($releaseAsset['name']), $expectedAssetNames, true)) {
+ if (in_array(strtolower($releaseAsset['name']), $possibleReleaseAssetNames, true)) {
return $releaseAsset;
}
}
- throw Exception\CouldNotFindReleaseAsset::forPackage($package, $expectedAssetNames);
+ throw Exception\CouldNotFindReleaseAsset::forPackage($package, $possibleReleaseAssetNames);
}
/** @return list */
@@ -74,16 +74,16 @@ private function getReleaseAssetsForPackage(
AuthHelper $authHelper,
HttpDownloader $httpDownloader,
): array {
- Assert::notNull($package->downloadUrl);
+ Assert::notNull($package->downloadUrl());
try {
$decodedRepsonse = $httpDownloader->get(
- $this->githubApiBaseUrl . '/repos/' . $package->githubOrgAndRepository() . '/releases/tags/' . $package->version,
+ $this->githubApiBaseUrl . '/repos/' . $package->githubOrgAndRepository() . '/releases/tags/' . $package->version(),
[
'retry-auth-failure' => false,
'http' => [
'method' => 'GET',
- 'header' => $authHelper->addAuthenticationHeader([], $this->githubApiBaseUrl, $package->downloadUrl),
+ 'header' => $authHelper->addAuthenticationHeader([], $this->githubApiBaseUrl, $package->downloadUrl()),
],
],
)->decodeJson();
diff --git a/src/Downloading/PackageReleaseAssets.php b/src/Downloading/PackageReleaseAssets.php
index 5f79cc37..4e498858 100644
--- a/src/Downloading/PackageReleaseAssets.php
+++ b/src/Downloading/PackageReleaseAssets.php
@@ -12,11 +12,16 @@
/** @internal This is not public API for PIE, so should not be depended upon unless you accept the risk of BC breaks */
interface PackageReleaseAssets
{
- /** @return non-empty-string */
- public function findWindowsDownloadUrlForPackage(
+ /**
+ * @param non-empty-list $possibleReleaseAssetNames
+ *
+ * @return non-empty-string
+ */
+ public function findMatchingReleaseAssetUrl(
TargetPlatform $targetPlatform,
Package $package,
AuthHelper $authHelper,
HttpDownloader $httpDownloader,
+ array $possibleReleaseAssetNames,
): string;
}
diff --git a/src/Installing/Ini/AddExtensionToTheIniFile.php b/src/Installing/Ini/AddExtensionToTheIniFile.php
index 73469e9e..f4cece32 100644
--- a/src/Installing/Ini/AddExtensionToTheIniFile.php
+++ b/src/Installing/Ini/AddExtensionToTheIniFile.php
@@ -63,7 +63,7 @@ public function __invoke(
$output->writeln(
sprintf(
'Enabled extension %s in the INI file %s',
- $package->extensionName->name(),
+ $package->extensionName()->name(),
$ini,
),
OutputInterface::VERBOSITY_VERBOSE,
@@ -73,7 +73,7 @@ public function __invoke(
return false;
}
- $phpBinaryPath->assertExtensionIsLoadedInRuntime($package->extensionName, $output);
+ $phpBinaryPath->assertExtensionIsLoadedInRuntime($package->extensionName(), $output);
return true;
} catch (Throwable $anything) {
@@ -81,7 +81,7 @@ public function __invoke(
$output->writeln(sprintf(
'Something went wrong enabling the %s extension: %s',
- $package->extensionName->name(),
+ $package->extensionName()->name(),
$anything->getMessage(),
));
@@ -93,10 +93,10 @@ public function __invoke(
private function iniFileContent(Package $package): string
{
return PHP_EOL
- . '; PIE automatically added this to enable the ' . $package->name . ' extension' . PHP_EOL
- . '; priority=' . $package->priority . PHP_EOL
- . ($package->extensionType === ExtensionType::PhpModule ? 'extension' : 'zend_extension')
+ . '; PIE automatically added this to enable the ' . $package->name() . ' extension' . PHP_EOL
+ . '; priority=' . $package->priority() . PHP_EOL
+ . ($package->extensionType() === ExtensionType::PhpModule ? 'extension' : 'zend_extension')
. '='
- . $package->extensionName->name() . PHP_EOL;
+ . $package->extensionName()->name() . PHP_EOL;
}
}
diff --git a/src/Installing/Ini/CheckAndAddExtensionToIniIfNeeded.php b/src/Installing/Ini/CheckAndAddExtensionToIniIfNeeded.php
index eec39db0..1c3a57e7 100644
--- a/src/Installing/Ini/CheckAndAddExtensionToIniIfNeeded.php
+++ b/src/Installing/Ini/CheckAndAddExtensionToIniIfNeeded.php
@@ -45,7 +45,7 @@ public function __invoke(
return false;
}
- if (($this->isExtensionAlreadyInTheIniFile)($iniFile, $downloadedPackage->package->extensionName)) {
+ if (($this->isExtensionAlreadyInTheIniFile)($iniFile, $downloadedPackage->package->extensionName())) {
$output->writeln(
sprintf(
'Extension is already enabled in the INI file %s',
@@ -59,13 +59,13 @@ public function __invoke(
}
try {
- $targetPlatform->phpBinaryPath->assertExtensionIsLoadedInRuntime($downloadedPackage->package->extensionName, $output);
+ $targetPlatform->phpBinaryPath->assertExtensionIsLoadedInRuntime($downloadedPackage->package->extensionName(), $output);
return true;
} catch (Throwable $anything) {
$output->writeln(sprintf(
'Something went wrong verifying the %s extension is enabled: %s',
- $downloadedPackage->package->extensionName->name(),
+ $downloadedPackage->package->extensionName()->name(),
$anything->getMessage(),
));
diff --git a/src/Installing/Ini/DockerPhpExtEnable.php b/src/Installing/Ini/DockerPhpExtEnable.php
index 2878af4d..195b80b1 100644
--- a/src/Installing/Ini/DockerPhpExtEnable.php
+++ b/src/Installing/Ini/DockerPhpExtEnable.php
@@ -41,12 +41,12 @@ public function setup(
}
try {
- $enableOutput = Process::run([$dockerPhpExtEnable, $downloadedPackage->package->extensionName->name()]);
+ $enableOutput = Process::run([$dockerPhpExtEnable, $downloadedPackage->package->extensionName()->name()]);
} catch (ProcessFailedException $processFailed) {
$output->writeln(
sprintf(
'Could not enable extension %s using %s. Exception was: %s',
- $downloadedPackage->package->extensionName->name(),
+ $downloadedPackage->package->extensionName()->name(),
$this->dockerPhpExtEnableName,
$processFailed->getMessage(),
),
@@ -58,7 +58,7 @@ public function setup(
try {
$targetPlatform->phpBinaryPath->assertExtensionIsLoadedInRuntime(
- $downloadedPackage->package->extensionName,
+ $downloadedPackage->package->extensionName(),
$output,
);
@@ -67,7 +67,7 @@ public function setup(
$output->writeln(
sprintf(
'Asserting that extension %s was enabled using %s failed. Output was: %s',
- $downloadedPackage->package->extensionName->name(),
+ $downloadedPackage->package->extensionName()->name(),
$this->dockerPhpExtEnableName,
$enableOutput !== '' ? $enableOutput : '(empty)',
),
diff --git a/src/Installing/Ini/OndrejPhpenmod.php b/src/Installing/Ini/OndrejPhpenmod.php
index 051dfb65..7c52d7de 100644
--- a/src/Installing/Ini/OndrejPhpenmod.php
+++ b/src/Installing/Ini/OndrejPhpenmod.php
@@ -119,7 +119,7 @@ public function setup(
'%s%s%s.ini',
rtrim($expectedModsAvailablePath, DIRECTORY_SEPARATOR),
DIRECTORY_SEPARATOR,
- $downloadedPackage->package->extensionName->name(),
+ $downloadedPackage->package->extensionName()->name(),
);
$pieCreatedTheIniFile = false;
@@ -148,7 +148,7 @@ static function () use ($phpenmodPath, $targetPlatform, $downloadedPackage, $out
$targetPlatform->phpBinaryPath->majorMinorVersion(),
'-s',
'ALL',
- $downloadedPackage->package->extensionName->name(),
+ $downloadedPackage->package->extensionName()->name(),
]);
return true;
@@ -157,7 +157,7 @@ static function () use ($phpenmodPath, $targetPlatform, $downloadedPackage, $out
sprintf(
'Failed to use %s to enable %s for PHP %s: %s',
$phpenmodPath,
- $downloadedPackage->package->extensionName->name(),
+ $downloadedPackage->package->extensionName()->name(),
$targetPlatform->phpBinaryPath->majorMinorVersion(),
$processFailedException->getMessage(),
),
diff --git a/src/Installing/Ini/PreCheckExtensionAlreadyLoaded.php b/src/Installing/Ini/PreCheckExtensionAlreadyLoaded.php
index 89f36819..9ae8c55f 100644
--- a/src/Installing/Ini/PreCheckExtensionAlreadyLoaded.php
+++ b/src/Installing/Ini/PreCheckExtensionAlreadyLoaded.php
@@ -26,7 +26,7 @@ public function setup(
): bool {
try {
$targetPlatform->phpBinaryPath->assertExtensionIsLoadedInRuntime(
- $downloadedPackage->package->extensionName,
+ $downloadedPackage->package->extensionName(),
$output,
);
diff --git a/src/Installing/Ini/StandardAdditionalPhpIniDirectory.php b/src/Installing/Ini/StandardAdditionalPhpIniDirectory.php
index 84a4b505..af94dab8 100644
--- a/src/Installing/Ini/StandardAdditionalPhpIniDirectory.php
+++ b/src/Installing/Ini/StandardAdditionalPhpIniDirectory.php
@@ -60,8 +60,8 @@ public function setup(
'%s%s%d-%s.ini',
rtrim($additionalIniFilesPath, DIRECTORY_SEPARATOR),
DIRECTORY_SEPARATOR,
- $downloadedPackage->package->priority,
- $downloadedPackage->package->extensionName->name(),
+ $downloadedPackage->package->priority(),
+ $downloadedPackage->package->extensionName()->name(),
);
$pieCreatedTheIniFile = false;
diff --git a/src/Installing/SetupIniFile.php b/src/Installing/SetupIniFile.php
index d6ca58bb..35b11f5c 100644
--- a/src/Installing/SetupIniFile.php
+++ b/src/Installing/SetupIniFile.php
@@ -45,8 +45,8 @@ public function __invoke(
$output->writeln('⚠️ Extension has NOT been automatically enabled.');
$output->writeln(sprintf(
'You must now add "%s=%s" to your php.ini',
- $downloadedPackage->package->extensionType === ExtensionType::PhpModule ? 'extension' : 'zend_extension',
- $downloadedPackage->package->extensionName->name(),
+ $downloadedPackage->package->extensionType() === ExtensionType::PhpModule ? 'extension' : 'zend_extension',
+ $downloadedPackage->package->extensionName()->name(),
));
}
}
diff --git a/src/Installing/UnixInstall.php b/src/Installing/UnixInstall.php
index da831eed..efe9beae 100644
--- a/src/Installing/UnixInstall.php
+++ b/src/Installing/UnixInstall.php
@@ -33,7 +33,7 @@ public function __invoke(
): BinaryFile {
$targetExtensionPath = $targetPlatform->phpBinaryPath->extensionPath();
- $sharedObjectName = $downloadedPackage->package->extensionName->name() . '.so';
+ $sharedObjectName = $downloadedPackage->package->extensionName()->name() . '.so';
$expectedSharedObjectLocation = sprintf(
'%s/%s',
$targetExtensionPath,
diff --git a/src/Installing/WindowsInstall.php b/src/Installing/WindowsInstall.php
index 7ff5ef1d..29d4ef2b 100644
--- a/src/Installing/WindowsInstall.php
+++ b/src/Installing/WindowsInstall.php
@@ -86,8 +86,8 @@ public function __invoke(
*/
$output->writeln(sprintf(
'You must now add "%s=%s" to your php.ini',
- $downloadedPackage->package->extensionType === ExtensionType::PhpModule ? 'extension' : 'zend_extension',
- $downloadedPackage->package->extensionName->name(),
+ $downloadedPackage->package->extensionType() === ExtensionType::PhpModule ? 'extension' : 'zend_extension',
+ $downloadedPackage->package->extensionName()->name(),
));
$binaryFile = BinaryFile::fromFileWithSha256Checksum($destinationDllName);
@@ -122,7 +122,7 @@ private function normalisedPathsMatch(string $first, string $second): bool
private function copyExtensionDll(TargetPlatform $targetPlatform, DownloadedPackage $downloadedPackage, string $sourceDllName): string
{
$destinationDllName = $targetPlatform->phpBinaryPath->extensionPath() . DIRECTORY_SEPARATOR
- . 'php_' . $downloadedPackage->package->extensionName->name() . '.dll';
+ . 'php_' . $downloadedPackage->package->extensionName()->name() . '.dll';
if (! copy($sourceDllName, $destinationDllName) || ! file_exists($destinationDllName) && ! is_file($destinationDllName)) {
throw new RuntimeException('Failed to install DLL to ' . $destinationDllName);
@@ -190,7 +190,7 @@ private function copyExtraFile(TargetPlatform $targetPlatform, DownloadedPackage
{
$destinationFullFilename = dirname($targetPlatform->phpBinaryPath->phpBinaryPath) . DIRECTORY_SEPARATOR
. 'extras' . DIRECTORY_SEPARATOR
- . $downloadedPackage->package->extensionName->name() . DIRECTORY_SEPARATOR
+ . $downloadedPackage->package->extensionName()->name() . DIRECTORY_SEPARATOR
. substr($file->getPathname(), strlen($downloadedPackage->extractedSourcePath) + 1);
$destinationPath = dirname($destinationFullFilename);
diff --git a/src/Platform/PrePackagedSourceAssetName.php b/src/Platform/PrePackagedSourceAssetName.php
new file mode 100644
index 00000000..3261b690
--- /dev/null
+++ b/src/Platform/PrePackagedSourceAssetName.php
@@ -0,0 +1,36 @@
+ */
+ public static function packageNames(Package $package): array
+ {
+ return [
+ strtolower(sprintf(
+ 'php_%s-%s-src.tgz',
+ $package->extensionName()->name(),
+ $package->version(),
+ )),
+ strtolower(sprintf(
+ 'php_%s-%s-src.zip',
+ $package->extensionName()->name(),
+ $package->version(),
+ )),
+ ];
+ }
+}
diff --git a/src/Platform/WindowsExtensionAssetName.php b/src/Platform/WindowsExtensionAssetName.php
index f2383c7e..9fe38f7f 100644
--- a/src/Platform/WindowsExtensionAssetName.php
+++ b/src/Platform/WindowsExtensionAssetName.php
@@ -36,8 +36,8 @@ private static function assetNames(TargetPlatform $targetPlatform, Package $pack
return [
strtolower(sprintf(
'php_%s-%s-%s-%s-%s-%s.%s',
- $package->extensionName->name(),
- $package->version,
+ $package->extensionName()->name(),
+ $package->version(),
$targetPlatform->phpBinaryPath->majorMinorVersion(),
$targetPlatform->threadSafety->asShort(),
strtolower($targetPlatform->windowsCompiler->name),
@@ -46,8 +46,8 @@ private static function assetNames(TargetPlatform $targetPlatform, Package $pack
)),
strtolower(sprintf(
'php_%s-%s-%s-%s-%s-%s.%s',
- $package->extensionName->name(),
- $package->version,
+ $package->extensionName()->name(),
+ $package->version(),
$targetPlatform->phpBinaryPath->majorMinorVersion(),
strtolower($targetPlatform->windowsCompiler->name),
$targetPlatform->threadSafety->asShort(),
diff --git a/test/assets/package-1.2.3/.gitkeep b/test/assets/package-1.2.3/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/test/assets/php_bar-1.2.3-src/config.m4 b/test/assets/php_bar-1.2.3-src/config.m4
new file mode 100644
index 00000000..21b6b7ec
--- /dev/null
+++ b/test/assets/php_bar-1.2.3-src/config.m4
@@ -0,0 +1 @@
+not really a config.m4 ;)
diff --git a/test/integration/Building/UnixBuildTest.php b/test/integration/Building/UnixBuildTest.php
index 976ca7a0..1d6daa6c 100644
--- a/test/integration/Building/UnixBuildTest.php
+++ b/test/integration/Building/UnixBuildTest.php
@@ -8,7 +8,6 @@
use Composer\Util\Platform;
use Php\Pie\Building\ExtensionBinaryNotFound;
use Php\Pie\Building\UnixBuild;
-use Php\Pie\ConfigureOption;
use Php\Pie\DependencyResolver\Package;
use Php\Pie\Downloading\DownloadedPackage;
use Php\Pie\ExtensionName;
@@ -44,13 +43,6 @@ public function testUnixBuildCanBuildExtension(): void
'pie_test_ext',
'0.1.0',
null,
- [ConfigureOption::fromComposerJsonDefinition(['name' => 'enable-pie_test_ext'])],
- true,
- true,
- null,
- null,
- null,
- 99,
),
self::TEST_EXTENSION_PATH,
);
@@ -100,13 +92,6 @@ public function testUnixBuildWillThrowExceptionWhenExpectedBinaryNameMismatches(
'pie_test_ext',
'0.1.0',
null,
- [ConfigureOption::fromComposerJsonDefinition(['name' => 'enable-pie_test_ext'])],
- true,
- true,
- null,
- null,
- null,
- 99,
),
self::TEST_EXTENSION_PATH,
);
@@ -136,22 +121,14 @@ public function testUnixBuildCanBuildExtensionWithBuildPath(): void
$output = new BufferedOutput();
+ $composerPackage = $this->createMock(CompletePackage::class);
+ $composerPackage->method('getPrettyName')->willReturn('myvendor/pie_test_ext');
+ $composerPackage->method('getPrettyVersion')->willReturn('0.1.0');
+ $composerPackage->method('getType')->willReturn('php-ext');
+ $composerPackage->method('getPhpExt')->willReturn(['build-path' => 'pie_test_ext']);
+
$downloadedPackage = DownloadedPackage::fromPackageAndExtractedPath(
- new Package(
- $this->createMock(CompletePackage::class),
- ExtensionType::PhpModule,
- ExtensionName::normaliseFromString('pie_test_ext'),
- 'pie_test_ext',
- '0.1.0',
- null,
- [ConfigureOption::fromComposerJsonDefinition(['name' => 'enable-pie_test_ext'])],
- true,
- true,
- 'pie_test_ext',
- null,
- null,
- 99,
- ),
+ Package::fromComposerCompletePackage($composerPackage),
dirname(self::TEST_EXTENSION_PATH),
);
@@ -204,13 +181,6 @@ public function testCleanupDoesNotCleanWhenConfigureIsMissing(): void
'pie_test_ext',
'0.1.0',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
self::TEST_EXTENSION_PATH,
);
@@ -249,13 +219,6 @@ public function testVerboseOutputShowsCleanupMessages(): void
'pie_test_ext',
'0.1.0',
null,
- [ConfigureOption::fromComposerJsonDefinition(['name' => 'enable-pie_test_ext'])],
- true,
- true,
- null,
- null,
- null,
- 99,
),
self::TEST_EXTENSION_PATH,
);
diff --git a/test/integration/DependencyResolver/ResolveDependencyWithComposerTest.php b/test/integration/DependencyResolver/ResolveDependencyWithComposerTest.php
index 43d5799e..c250fbf5 100644
--- a/test/integration/DependencyResolver/ResolveDependencyWithComposerTest.php
+++ b/test/integration/DependencyResolver/ResolveDependencyWithComposerTest.php
@@ -98,8 +98,8 @@ public function testDependenciesAreResolvedToExpectedVersions(
false,
);
- self::assertSame($expectedVersion, $package->version);
- self::assertNotNull($package->downloadUrl);
- self::assertStringMatchesFormat($expectedDownloadUrl, $package->downloadUrl);
+ self::assertSame($expectedVersion, $package->version());
+ self::assertNotNull($package->downloadUrl());
+ self::assertStringMatchesFormat($expectedDownloadUrl, $package->downloadUrl());
}
}
diff --git a/test/integration/Downloading/GithubPackageReleaseAssetsTest.php b/test/integration/Downloading/GithubPackageReleaseAssetsTest.php
index 1bd9d56a..4dd883c9 100644
--- a/test/integration/Downloading/GithubPackageReleaseAssetsTest.php
+++ b/test/integration/Downloading/GithubPackageReleaseAssetsTest.php
@@ -20,6 +20,7 @@
use Php\Pie\Platform\TargetPlatform;
use Php\Pie\Platform\ThreadSafetyMode;
use Php\Pie\Platform\WindowsCompiler;
+use Php\Pie\Platform\WindowsExtensionAssetName;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
@@ -53,13 +54,6 @@ public function testDeterminingReleaseAssetUrlForWindows(): void
'asgrim/example-pie-extension',
'2.0.2',
'https://api.github.com/repos/asgrim/example-pie-extension/zipball/f9ed13ea95dada34c6cc5a052da258dbda059d27',
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
);
$io = $this->createMock(IOInterface::class);
@@ -77,11 +71,15 @@ public function testDeterminingReleaseAssetUrlForWindows(): void
self::assertSame(
'https://github.com/asgrim/example-pie-extension/releases/download/2.0.2/php_example_pie_extension-2.0.2-8.3-ts-vs16-x86_64.zip',
(new GithubPackageReleaseAssets('https://api.github.com'))
- ->findWindowsDownloadUrlForPackage(
+ ->findMatchingReleaseAssetUrl(
$targetPlatform,
$package,
new AuthHelper($io, $config),
new HttpDownloader($io, $config),
+ WindowsExtensionAssetName::zipNames(
+ $targetPlatform,
+ $package,
+ ),
),
);
}
diff --git a/test/integration/Installing/UnixInstallTest.php b/test/integration/Installing/UnixInstallTest.php
index ca28ee0d..1156eb69 100644
--- a/test/integration/Installing/UnixInstallTest.php
+++ b/test/integration/Installing/UnixInstallTest.php
@@ -7,7 +7,6 @@
use Composer\Package\CompletePackage;
use Composer\Util\Platform;
use Php\Pie\Building\UnixBuild;
-use Php\Pie\ConfigureOption;
use Php\Pie\DependencyResolver\Package;
use Php\Pie\Downloading\DownloadedPackage;
use Php\Pie\ExtensionName;
@@ -89,13 +88,6 @@ public function testUnixInstallCanInstallExtension(string $phpConfig): void
'pie_test_ext',
'0.1.0',
null,
- [ConfigureOption::fromComposerJsonDefinition(['name' => 'enable-pie_test_ext'])],
- true,
- true,
- null,
- null,
- null,
- 99,
),
self::TEST_EXTENSION_PATH,
);
diff --git a/test/integration/Installing/WindowsInstallTest.php b/test/integration/Installing/WindowsInstallTest.php
index 4d043415..58cb0653 100644
--- a/test/integration/Installing/WindowsInstallTest.php
+++ b/test/integration/Installing/WindowsInstallTest.php
@@ -53,13 +53,6 @@ public function testWindowsInstallCanInstallExtension(): void
'php/pie-test-ext',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
self::TEST_EXTENSION_PATH,
);
diff --git a/test/unit/Command/CommandHelperTest.php b/test/unit/Command/CommandHelperTest.php
index f70eb932..73f80d77 100644
--- a/test/unit/Command/CommandHelperTest.php
+++ b/test/unit/Command/CommandHelperTest.php
@@ -14,11 +14,8 @@
use Composer\Util\Platform;
use InvalidArgumentException;
use Php\Pie\Command\CommandHelper;
-use Php\Pie\ConfigureOption;
use Php\Pie\DependencyResolver\Package;
use Php\Pie\DependencyResolver\RequestedPackageAndVersion;
-use Php\Pie\ExtensionName;
-use Php\Pie\ExtensionType;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily;
@@ -102,27 +99,21 @@ public function testBindingConfigurationOptionsFromPackage(): void
public function testProcessingConfigureOptionsFromInput(): void
{
- $package = new Package(
- $this->createMock(CompletePackage::class),
- ExtensionType::PhpModule,
- ExtensionName::normaliseFromString('lolz'),
- 'foo/bar',
- '1.0.0',
- null,
- [
- ConfigureOption::fromComposerJsonDefinition([
+ $composerPackage = $this->createMock(CompletePackage::class);
+ $composerPackage->method('getPrettyName')->willReturn('foo/bar');
+ $composerPackage->method('getPrettyVersion')->willReturn('1.0.0');
+ $composerPackage->method('getType')->willReturn('php-ext');
+ $composerPackage->method('getPhpExt')->willReturn([
+ 'configure-options' => [
+ [
'name' => 'with-stuff',
'needs-value' => true,
- ]),
- ConfigureOption::fromComposerJsonDefinition(['name' => 'enable-thing']),
+ ],
+ ['name' => 'enable-thing'],
],
- true,
- true,
- null,
- null,
- null,
- 99,
- );
+ ]);
+ $package = Package::fromComposerCompletePackage($composerPackage);
+
$inputDefinition = new InputDefinition();
$inputDefinition->addOption(new InputOption('with-stuff', null, InputOption::VALUE_REQUIRED));
$inputDefinition->addOption(new InputOption('enable-thing', null, InputOption::VALUE_NONE));
diff --git a/test/unit/ComposerIntegration/Listeners/OverrideDownloadUrlInstallListenerTest.php b/test/unit/ComposerIntegration/Listeners/OverrideDownloadUrlInstallListenerTest.php
new file mode 100644
index 00000000..859bdb9a
--- /dev/null
+++ b/test/unit/ComposerIntegration/Listeners/OverrideDownloadUrlInstallListenerTest.php
@@ -0,0 +1,399 @@
+composer = $this->createMock(Composer::class);
+ $this->io = $this->createMock(IOInterface::class);
+ $this->container = $this->createMock(ContainerInterface::class);
+ }
+
+ public function testEventListenerRegistration(): void
+ {
+ $eventDispatcher = $this->createMock(EventDispatcher::class);
+ $eventDispatcher
+ ->expects(self::once())
+ ->method('addListener')
+ ->with(
+ InstallerEvents::PRE_OPERATIONS_EXEC,
+ self::isInstanceOf(OverrideDownloadUrlInstallListener::class),
+ );
+
+ $this->composer
+ ->expects(self::once())
+ ->method('getEventDispatcher')
+ ->willReturn($eventDispatcher);
+
+ OverrideDownloadUrlInstallListener::selfRegister(
+ $this->composer,
+ $this->io,
+ $this->container,
+ new PieComposerRequest(
+ $this->createMock(OutputInterface::class),
+ new TargetPlatform(
+ OperatingSystem::NonWindows,
+ OperatingSystemFamily::Linux,
+ PhpBinaryPath::fromCurrentProcess(),
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ WindowsCompiler::VC15,
+ ),
+ new RequestedPackageAndVersion('foo/bar', '^1.1'),
+ PieOperation::Install,
+ [],
+ null,
+ false,
+ ),
+ );
+ }
+
+ public function testNonInstallOperationsAreIgnored(): void
+ {
+ $composerPackage = new CompletePackage('foo/bar', '1.2.3.0', '1.2.3');
+ $composerPackage->setDistUrl('https://example.com/git-archive-zip-url');
+
+ /**
+ * @psalm-suppress InternalClass
+ * @psalm-suppress InternalMethod
+ */
+ $installerEvent = new InstallerEvent(
+ InstallerEvents::PRE_OPERATIONS_EXEC,
+ $this->composer,
+ $this->io,
+ false,
+ true,
+ new Transaction([$composerPackage], []),
+ );
+
+ $this->container
+ ->expects(self::never())
+ ->method('get');
+
+ (new OverrideDownloadUrlInstallListener(
+ $this->composer,
+ $this->io,
+ $this->container,
+ new PieComposerRequest(
+ $this->createMock(OutputInterface::class),
+ new TargetPlatform(
+ OperatingSystem::NonWindows,
+ OperatingSystemFamily::Linux,
+ PhpBinaryPath::fromCurrentProcess(),
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ WindowsCompiler::VC15,
+ ),
+ new RequestedPackageAndVersion('foo/bar', '^1.1'),
+ PieOperation::Install,
+ [],
+ null,
+ false,
+ ),
+ ))($installerEvent);
+ }
+
+ public function testNonCompletePackagesAreIgnored(): void
+ {
+ $composerPackage = new Package('foo/bar', '1.2.3.0', '1.2.3');
+ $composerPackage->setDistUrl('https://example.com/git-archive-zip-url');
+
+ /**
+ * @psalm-suppress InternalClass
+ * @psalm-suppress InternalMethod
+ */
+ $installerEvent = new InstallerEvent(
+ InstallerEvents::PRE_OPERATIONS_EXEC,
+ $this->composer,
+ $this->io,
+ false,
+ true,
+ new Transaction([], [$composerPackage]),
+ );
+
+ $this->container
+ ->expects(self::never())
+ ->method('get');
+
+ (new OverrideDownloadUrlInstallListener(
+ $this->composer,
+ $this->io,
+ $this->container,
+ new PieComposerRequest(
+ $this->createMock(OutputInterface::class),
+ new TargetPlatform(
+ OperatingSystem::NonWindows,
+ OperatingSystemFamily::Linux,
+ PhpBinaryPath::fromCurrentProcess(),
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ WindowsCompiler::VC15,
+ ),
+ new RequestedPackageAndVersion('foo/bar', '^1.1'),
+ PieOperation::Install,
+ [],
+ null,
+ false,
+ ),
+ ))($installerEvent);
+ }
+
+ public function testInstallOperationsForDifferentPackagesAreIgnored(): void
+ {
+ $composerPackage = new CompletePackage('different/package', '1.2.3.0', '1.2.3');
+ $composerPackage->setDistUrl('https://example.com/git-archive-zip-url');
+
+ /**
+ * @psalm-suppress InternalClass
+ * @psalm-suppress InternalMethod
+ */
+ $installerEvent = new InstallerEvent(
+ InstallerEvents::PRE_OPERATIONS_EXEC,
+ $this->composer,
+ $this->io,
+ false,
+ true,
+ new Transaction([], [$composerPackage]),
+ );
+
+ $this->container
+ ->expects(self::never())
+ ->method('get');
+
+ (new OverrideDownloadUrlInstallListener(
+ $this->composer,
+ $this->io,
+ $this->container,
+ new PieComposerRequest(
+ $this->createMock(OutputInterface::class),
+ new TargetPlatform(
+ OperatingSystem::NonWindows,
+ OperatingSystemFamily::Linux,
+ PhpBinaryPath::fromCurrentProcess(),
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ WindowsCompiler::VC15,
+ ),
+ new RequestedPackageAndVersion('foo/bar', '^1.1'),
+ PieOperation::Install,
+ [],
+ null,
+ false,
+ ),
+ ))($installerEvent);
+ }
+
+ public function testWindowsUrlInstallerDoesNotRunOnNonWindows(): void
+ {
+ $composerPackage = new CompletePackage('foo/bar', '1.2.3.0', '1.2.3');
+ $composerPackage->setDistUrl('https://example.com/git-archive-zip-url');
+
+ /**
+ * @psalm-suppress InternalClass
+ * @psalm-suppress InternalMethod
+ */
+ $installerEvent = new InstallerEvent(
+ InstallerEvents::PRE_OPERATIONS_EXEC,
+ $this->composer,
+ $this->io,
+ false,
+ true,
+ new Transaction([], [$composerPackage]),
+ );
+
+ $this->container
+ ->expects(self::never())
+ ->method('get');
+
+ (new OverrideDownloadUrlInstallListener(
+ $this->composer,
+ $this->io,
+ $this->container,
+ new PieComposerRequest(
+ $this->createMock(OutputInterface::class),
+ new TargetPlatform(
+ OperatingSystem::NonWindows,
+ OperatingSystemFamily::Linux,
+ PhpBinaryPath::fromCurrentProcess(),
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ WindowsCompiler::VC15,
+ ),
+ new RequestedPackageAndVersion('foo/bar', '^1.1'),
+ PieOperation::Install,
+ [],
+ null,
+ false,
+ ),
+ ))($installerEvent);
+
+ self::assertSame(
+ 'https://example.com/git-archive-zip-url',
+ $composerPackage->getDistUrl(),
+ );
+ }
+
+ public function testDistUrlIsUpdatedForWindowsInstallers(): void
+ {
+ $composerPackage = new CompletePackage('foo/bar', '1.2.3.0', '1.2.3');
+ $composerPackage->setDistUrl('https://example.com/git-archive-zip-url');
+
+ /**
+ * @psalm-suppress InternalClass
+ * @psalm-suppress InternalMethod
+ */
+ $installerEvent = new InstallerEvent(
+ InstallerEvents::PRE_OPERATIONS_EXEC,
+ $this->composer,
+ $this->io,
+ false,
+ true,
+ new Transaction([], [$composerPackage]),
+ );
+
+ $packageReleaseAssets = $this->createMock(PackageReleaseAssets::class);
+ $packageReleaseAssets
+ ->expects(self::once())
+ ->method('findMatchingReleaseAssetUrl')
+ ->willReturn('https://example.com/windows-download-url');
+
+ $this->container
+ ->method('get')
+ ->with(PackageReleaseAssets::class)
+ ->willReturn($packageReleaseAssets);
+
+ (new OverrideDownloadUrlInstallListener(
+ $this->composer,
+ $this->io,
+ $this->container,
+ new PieComposerRequest(
+ $this->createMock(OutputInterface::class),
+ new TargetPlatform(
+ OperatingSystem::Windows,
+ OperatingSystemFamily::Linux,
+ PhpBinaryPath::fromCurrentProcess(),
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ WindowsCompiler::VC15,
+ ),
+ new RequestedPackageAndVersion('foo/bar', '^1.1'),
+ PieOperation::Install,
+ [],
+ null,
+ false,
+ ),
+ ))($installerEvent);
+
+ self::assertSame(
+ 'https://example.com/windows-download-url',
+ $composerPackage->getDistUrl(),
+ );
+ }
+
+ public function testDistUrlIsUpdatedForPrePackagedTgzSource(): void
+ {
+ $composerPackage = new CompletePackage('foo/bar', '1.2.3.0', '1.2.3');
+ $composerPackage->setDistType('zip');
+ $composerPackage->setDistUrl('https://example.com/git-archive-zip-url');
+ $composerPackage->setPhpExt([
+ 'extension-name' => 'foobar',
+ 'download-url-method' => 'pre-packaged-source',
+ ]);
+
+ /**
+ * @psalm-suppress InternalClass
+ * @psalm-suppress InternalMethod
+ */
+ $installerEvent = new InstallerEvent(
+ InstallerEvents::PRE_OPERATIONS_EXEC,
+ $this->composer,
+ $this->io,
+ false,
+ true,
+ new Transaction([], [$composerPackage]),
+ );
+
+ $packageReleaseAssets = $this->createMock(PackageReleaseAssets::class);
+ $packageReleaseAssets
+ ->expects(self::once())
+ ->method('findMatchingReleaseAssetUrl')
+ ->willReturn('https://example.com/pre-packaged-source-download-url.tgz');
+
+ $this->container
+ ->method('get')
+ ->with(PackageReleaseAssets::class)
+ ->willReturn($packageReleaseAssets);
+
+ (new OverrideDownloadUrlInstallListener(
+ $this->composer,
+ $this->io,
+ $this->container,
+ new PieComposerRequest(
+ $this->createMock(OutputInterface::class),
+ new TargetPlatform(
+ OperatingSystem::NonWindows,
+ OperatingSystemFamily::Linux,
+ PhpBinaryPath::fromCurrentProcess(),
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ WindowsCompiler::VC15,
+ ),
+ new RequestedPackageAndVersion('foo/bar', '^1.1'),
+ PieOperation::Install,
+ [],
+ null,
+ false,
+ ),
+ ))($installerEvent);
+
+ self::assertSame(
+ 'https://example.com/pre-packaged-source-download-url.tgz',
+ $composerPackage->getDistUrl(),
+ );
+ self::assertSame('tar', $composerPackage->getDistType());
+ }
+}
diff --git a/test/unit/ComposerIntegration/RemoveUnrelatedInstallOperationsTest.php b/test/unit/ComposerIntegration/Listeners/RemoveUnrelatedInstallOperationsTest.php
similarity index 97%
rename from test/unit/ComposerIntegration/RemoveUnrelatedInstallOperationsTest.php
rename to test/unit/ComposerIntegration/Listeners/RemoveUnrelatedInstallOperationsTest.php
index 0703e3b0..f251c42a 100644
--- a/test/unit/ComposerIntegration/RemoveUnrelatedInstallOperationsTest.php
+++ b/test/unit/ComposerIntegration/Listeners/RemoveUnrelatedInstallOperationsTest.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Php\PieUnitTest\ComposerIntegration;
+namespace Php\PieUnitTest\ComposerIntegration\Listeners;
use Composer\Composer;
use Composer\DependencyResolver\Operation\InstallOperation;
@@ -13,9 +13,9 @@
use Composer\Installer\InstallerEvents;
use Composer\IO\IOInterface;
use Composer\Package\CompletePackage;
+use Php\Pie\ComposerIntegration\Listeners\RemoveUnrelatedInstallOperations;
use Php\Pie\ComposerIntegration\PieComposerRequest;
use Php\Pie\ComposerIntegration\PieOperation;
-use Php\Pie\ComposerIntegration\RemoveUnrelatedInstallOperations;
use Php\Pie\DependencyResolver\RequestedPackageAndVersion;
use Php\Pie\Platform\Architecture;
use Php\Pie\Platform\OperatingSystem;
diff --git a/test/unit/ComposerIntegration/OverrideWindowsUrlInstallListenerTest.php b/test/unit/ComposerIntegration/OverrideWindowsUrlInstallListenerTest.php
deleted file mode 100644
index 8e9d2697..00000000
--- a/test/unit/ComposerIntegration/OverrideWindowsUrlInstallListenerTest.php
+++ /dev/null
@@ -1,196 +0,0 @@
-composer = $this->createMock(Composer::class);
- $this->io = $this->createMock(IOInterface::class);
- $this->container = $this->createMock(ContainerInterface::class);
- }
-
- public function testEventListenerRegistration(): void
- {
- $eventDispatcher = $this->createMock(EventDispatcher::class);
- $eventDispatcher
- ->expects(self::once())
- ->method('addListener')
- ->with(
- InstallerEvents::PRE_OPERATIONS_EXEC,
- self::isInstanceOf(OverrideWindowsUrlInstallListener::class),
- );
-
- $this->composer
- ->expects(self::once())
- ->method('getEventDispatcher')
- ->willReturn($eventDispatcher);
-
- OverrideWindowsUrlInstallListener::selfRegister(
- $this->composer,
- $this->io,
- $this->container,
- new PieComposerRequest(
- $this->createMock(OutputInterface::class),
- new TargetPlatform(
- OperatingSystem::NonWindows,
- OperatingSystemFamily::Linux,
- PhpBinaryPath::fromCurrentProcess(),
- Architecture::x86_64,
- ThreadSafetyMode::NonThreadSafe,
- 1,
- WindowsCompiler::VC15,
- ),
- new RequestedPackageAndVersion('foo/bar', '^1.1'),
- PieOperation::Install,
- [],
- null,
- false,
- ),
- );
- }
-
- public function testWindowsUrlInstallerDoesNotRunOnNonWindows(): void
- {
- $composerPackage = new CompletePackage('foo/bar', '1.2.3.0', '1.2.3');
- $composerPackage->setDistUrl('https://example.com/git-archive-zip-url');
-
- /**
- * @psalm-suppress InternalClass
- * @psalm-suppress InternalMethod
- */
- $installerEvent = new InstallerEvent(
- InstallerEvents::PRE_OPERATIONS_EXEC,
- $this->composer,
- $this->io,
- false,
- true,
- new Transaction([], [$composerPackage]),
- );
-
- $this->container
- ->expects(self::never())
- ->method('get');
-
- (new OverrideWindowsUrlInstallListener(
- $this->composer,
- $this->io,
- $this->container,
- new PieComposerRequest(
- $this->createMock(OutputInterface::class),
- new TargetPlatform(
- OperatingSystem::NonWindows,
- OperatingSystemFamily::Linux,
- PhpBinaryPath::fromCurrentProcess(),
- Architecture::x86_64,
- ThreadSafetyMode::NonThreadSafe,
- 1,
- WindowsCompiler::VC15,
- ),
- new RequestedPackageAndVersion('foo/bar', '^1.1'),
- PieOperation::Install,
- [],
- null,
- false,
- ),
- ))($installerEvent);
-
- self::assertSame(
- 'https://example.com/git-archive-zip-url',
- $composerPackage->getDistUrl(),
- );
- }
-
- public function testDistUrlIsUpdatedForWindowsInstallers(): void
- {
- $composerPackage = new CompletePackage('foo/bar', '1.2.3.0', '1.2.3');
- $composerPackage->setDistUrl('https://example.com/git-archive-zip-url');
-
- /**
- * @psalm-suppress InternalClass
- * @psalm-suppress InternalMethod
- */
- $installerEvent = new InstallerEvent(
- InstallerEvents::PRE_OPERATIONS_EXEC,
- $this->composer,
- $this->io,
- false,
- true,
- new Transaction([], [$composerPackage]),
- );
-
- $packageReleaseAssets = $this->createMock(PackageReleaseAssets::class);
- $packageReleaseAssets
- ->expects(self::once())
- ->method('findWindowsDownloadUrlForPackage')
- ->willReturn('https://example.com/windows-download-url');
-
- $this->container
- ->method('get')
- ->with(PackageReleaseAssets::class)
- ->willReturn($packageReleaseAssets);
-
- (new OverrideWindowsUrlInstallListener(
- $this->composer,
- $this->io,
- $this->container,
- new PieComposerRequest(
- $this->createMock(OutputInterface::class),
- new TargetPlatform(
- OperatingSystem::Windows,
- OperatingSystemFamily::Linux,
- PhpBinaryPath::fromCurrentProcess(),
- Architecture::x86_64,
- ThreadSafetyMode::NonThreadSafe,
- 1,
- WindowsCompiler::VC15,
- ),
- new RequestedPackageAndVersion('foo/bar', '^1.1'),
- PieOperation::Install,
- [],
- null,
- false,
- ),
- ))($installerEvent);
-
- self::assertSame(
- 'https://example.com/windows-download-url',
- $composerPackage->getDistUrl(),
- );
- }
-}
diff --git a/test/unit/DependencyResolver/PackageTest.php b/test/unit/DependencyResolver/PackageTest.php
index fc99924a..47b3b10e 100644
--- a/test/unit/DependencyResolver/PackageTest.php
+++ b/test/unit/DependencyResolver/PackageTest.php
@@ -23,12 +23,12 @@ public function testFromComposerCompletePackage(): void
new CompletePackage('vendor/foo', '1.2.3.0', '1.2.3'),
);
- self::assertSame('foo', $package->extensionName->name());
- self::assertSame('vendor/foo', $package->name);
- self::assertSame('1.2.3', $package->version);
+ self::assertSame('foo', $package->extensionName()->name());
+ self::assertSame('vendor/foo', $package->name());
+ self::assertSame('1.2.3', $package->version());
self::assertSame('vendor/foo:1.2.3', $package->prettyNameAndVersion());
- self::assertNull($package->downloadUrl);
- self::assertNull($package->buildPath);
+ self::assertNull($package->downloadUrl());
+ self::assertNull($package->buildPath());
}
public function testFromComposerCompletePackageWithExtensionName(): void
@@ -38,11 +38,11 @@ public function testFromComposerCompletePackageWithExtensionName(): void
$package = Package::fromComposerCompletePackage($composerCompletePackage);
- self::assertSame('something_else', $package->extensionName->name());
- self::assertSame('vendor/foo', $package->name);
- self::assertSame('1.2.3', $package->version);
+ self::assertSame('something_else', $package->extensionName()->name());
+ self::assertSame('vendor/foo', $package->name());
+ self::assertSame('1.2.3', $package->version());
self::assertSame('vendor/foo:1.2.3', $package->prettyNameAndVersion());
- self::assertNull($package->downloadUrl);
+ self::assertNull($package->downloadUrl());
}
public function testFromComposerCompletePackageWithExcludedOsFamilies(): void
@@ -52,11 +52,11 @@ public function testFromComposerCompletePackageWithExcludedOsFamilies(): void
$package = Package::fromComposerCompletePackage($composerCompletePackage);
- self::assertSame([OperatingSystemFamily::Windows, OperatingSystemFamily::Darwin], $package->incompatibleOsFamilies);
- self::assertSame('vendor/foo', $package->name);
- self::assertSame('1.2.3', $package->version);
+ self::assertSame([OperatingSystemFamily::Windows, OperatingSystemFamily::Darwin], $package->incompatibleOsFamilies());
+ self::assertSame('vendor/foo', $package->name());
+ self::assertSame('1.2.3', $package->version());
self::assertSame('vendor/foo:1.2.3', $package->prettyNameAndVersion());
- self::assertNull($package->downloadUrl);
+ self::assertNull($package->downloadUrl());
}
public function testFromComposerCompletePackageWithOsFamilies(): void
@@ -66,12 +66,12 @@ public function testFromComposerCompletePackageWithOsFamilies(): void
$package = Package::fromComposerCompletePackage($composerCompletePackage);
- self::assertEmpty($package->incompatibleOsFamilies);
- self::assertSame([OperatingSystemFamily::Windows, OperatingSystemFamily::Darwin], $package->compatibleOsFamilies);
- self::assertSame('vendor/foo', $package->name);
- self::assertSame('1.2.3', $package->version);
+ self::assertEmpty($package->incompatibleOsFamilies());
+ self::assertSame([OperatingSystemFamily::Windows, OperatingSystemFamily::Darwin], $package->compatibleOsFamilies());
+ self::assertSame('vendor/foo', $package->name());
+ self::assertSame('1.2.3', $package->version());
self::assertSame('vendor/foo:1.2.3', $package->prettyNameAndVersion());
- self::assertNull($package->downloadUrl);
+ self::assertNull($package->downloadUrl());
}
public function testFromComposerCompletePackageWithBothOsFamiliesAndExcludedOsFamiliesThrows(): void
@@ -134,13 +134,6 @@ public function testGithubOrgAndRepo(string $composerPackageName, string|null $d
$composerPackageName,
'1.2.3',
$downloadUrl,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
);
self::assertSame($expectedGithubOrgAndRepo, $package->githubOrgAndRepository());
@@ -154,6 +147,6 @@ public function testFromComposerCompletePackageWithBuildPath(): void
$package = Package::fromComposerCompletePackage($composerCompletePackage);
self::assertSame('vendor/foo:1.2.3', $package->prettyNameAndVersion());
- self::assertSame('some/subdirectory/path/', $package->buildPath);
+ self::assertSame('some/subdirectory/path/', $package->buildPath());
}
}
diff --git a/test/unit/DependencyResolver/ResolveDependencyWithComposerTest.php b/test/unit/DependencyResolver/ResolveDependencyWithComposerTest.php
index 6cdd9a4b..9e9f828e 100644
--- a/test/unit/DependencyResolver/ResolveDependencyWithComposerTest.php
+++ b/test/unit/DependencyResolver/ResolveDependencyWithComposerTest.php
@@ -66,8 +66,8 @@ public function testPackageThatCanBeResolved(): void
$this->createMock(QuieterConsoleIO::class),
))($this->composer, $targetPlatform, new RequestedPackageAndVersion('asgrim/example-pie-extension', '^1.0'), false);
- self::assertSame('asgrim/example-pie-extension', $package->name);
- self::assertStringStartsWith('1.', $package->version);
+ self::assertSame('asgrim/example-pie-extension', $package->name());
+ self::assertStringStartsWith('1.', $package->version());
}
/**
@@ -159,8 +159,8 @@ public function testUnresolvedPackageCanBeInstalledWithForceOption(array $platfo
true,
);
- self::assertSame('asgrim/example-pie-extension', $package->name);
- self::assertStringStartsWith('1.', $package->version);
+ self::assertSame('asgrim/example-pie-extension', $package->name());
+ self::assertStringStartsWith('1.', $package->version());
}
public function testZtsOnlyPackageCannotBeInstalledOnNtsSystem(): void
diff --git a/test/unit/Downloading/DownloadUrlMethodTest.php b/test/unit/Downloading/DownloadUrlMethodTest.php
new file mode 100644
index 00000000..f48b8e86
--- /dev/null
+++ b/test/unit/Downloading/DownloadUrlMethodTest.php
@@ -0,0 +1,125 @@
+createMock(CompletePackageInterface::class),
+ ExtensionType::PhpModule,
+ ExtensionName::normaliseFromString('foo'),
+ 'foo/foo',
+ '1.2.3',
+ null,
+ );
+
+ $phpBinaryPath = $this->createMock(PhpBinaryPath::class);
+ $phpBinaryPath
+ ->method('majorMinorVersion')
+ ->willReturn('8.1');
+
+ $targetPlatform = new TargetPlatform(
+ OperatingSystem::Windows,
+ OperatingSystemFamily::Windows,
+ $phpBinaryPath,
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ WindowsCompiler::VC15,
+ );
+
+ $downloadUrlMethod = DownloadUrlMethod::fromPackage($package, $targetPlatform);
+
+ self::assertSame(DownloadUrlMethod::WindowsBinaryDownload, $downloadUrlMethod);
+
+ self::assertSame(
+ [
+ 'php_foo-1.2.3-8.1-nts-vc15-x86_64.zip',
+ 'php_foo-1.2.3-8.1-vc15-nts-x86_64.zip',
+ ],
+ $downloadUrlMethod->possibleAssetNames($package, $targetPlatform),
+ );
+ }
+
+ public function testPrePackagedSourceDownloads(): void
+ {
+ $composerPackage = $this->createMock(CompletePackage::class);
+ $composerPackage->method('getPrettyName')->willReturn('foo/bar');
+ $composerPackage->method('getPrettyVersion')->willReturn('1.2.3');
+ $composerPackage->method('getType')->willReturn('php-ext');
+ $composerPackage->method('getPhpExt')->willReturn(['download-url-method' => 'pre-packaged-source']);
+
+ $package = Package::fromComposerCompletePackage($composerPackage);
+
+ $targetPlatform = new TargetPlatform(
+ OperatingSystem::NonWindows,
+ OperatingSystemFamily::Linux,
+ PhpBinaryPath::fromCurrentProcess(),
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ null,
+ );
+
+ $downloadUrlMethod = DownloadUrlMethod::fromPackage($package, $targetPlatform);
+
+ self::assertSame(DownloadUrlMethod::PrePackagedSourceDownload, $downloadUrlMethod);
+
+ self::assertSame(
+ [
+ 'php_bar-1.2.3-src.tgz',
+ 'php_bar-1.2.3-src.zip',
+ ],
+ $downloadUrlMethod->possibleAssetNames($package, $targetPlatform),
+ );
+ }
+
+ public function testComposerDefaultDownload(): void
+ {
+ $package = new Package(
+ $this->createMock(CompletePackageInterface::class),
+ ExtensionType::PhpModule,
+ ExtensionName::normaliseFromString('foo'),
+ 'foo/foo',
+ '1.2.3',
+ null,
+ );
+
+ $targetPlatform = new TargetPlatform(
+ OperatingSystem::NonWindows,
+ OperatingSystemFamily::Linux,
+ PhpBinaryPath::fromCurrentProcess(),
+ Architecture::x86_64,
+ ThreadSafetyMode::NonThreadSafe,
+ 1,
+ null,
+ );
+
+ $downloadUrlMethod = DownloadUrlMethod::fromPackage($package, $targetPlatform);
+
+ self::assertSame(DownloadUrlMethod::ComposerDefaultDownload, $downloadUrlMethod);
+
+ self::assertNull($downloadUrlMethod->possibleAssetNames($package, $targetPlatform));
+ }
+}
diff --git a/test/unit/Downloading/DownloadedPackageTest.php b/test/unit/Downloading/DownloadedPackageTest.php
index c4edf0b2..4ffb581e 100644
--- a/test/unit/Downloading/DownloadedPackageTest.php
+++ b/test/unit/Downloading/DownloadedPackageTest.php
@@ -29,13 +29,6 @@ public function testFromPackageAndExtractedPath(): void
'foo/bar',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
);
$extractedSourcePath = uniqid('/path/to/downloaded/package', true);
@@ -48,21 +41,13 @@ public function testFromPackageAndExtractedPath(): void
public function testFromPackageAndExtractedPathWithBuildPath(): void
{
- $package = new Package(
- $this->createMock(CompletePackage::class),
- ExtensionType::PhpModule,
- ExtensionName::normaliseFromString('foo'),
- 'foo/bar',
- '1.2.3',
- null,
- [],
- true,
- true,
- 'Downloading',
- null,
- null,
- 99,
- );
+ $composerPackage = $this->createMock(CompletePackage::class);
+ $composerPackage->method('getPrettyName')->willReturn('foo/bar');
+ $composerPackage->method('getPrettyVersion')->willReturn('1.2.3');
+ $composerPackage->method('getType')->willReturn('php-ext');
+ $composerPackage->method('getPhpExt')->willReturn(['build-path' => 'Downloading']);
+
+ $package = Package::fromComposerCompletePackage($composerPackage);
$extractedSourcePath = realpath(__DIR__ . '/../');
@@ -71,4 +56,39 @@ public function testFromPackageAndExtractedPathWithBuildPath(): void
self::assertSame($extractedSourcePath . DIRECTORY_SEPARATOR . 'Downloading', $downloadedPackage->extractedSourcePath);
self::assertSame($package, $downloadedPackage->package);
}
+
+ public function testFromPackageAndExtractedPathWithBuildPathWithVersionTemplate(): void
+ {
+ $composerPackage = $this->createMock(CompletePackage::class);
+ $composerPackage->method('getPrettyName')->willReturn('foo/bar');
+ $composerPackage->method('getPrettyVersion')->willReturn('1.2.3');
+ $composerPackage->method('getType')->willReturn('php-ext');
+ $composerPackage->method('getPhpExt')->willReturn(['build-path' => 'package-{version}']);
+
+ $package = Package::fromComposerCompletePackage($composerPackage);
+
+ $extractedSourcePath = realpath(__DIR__ . '/../../assets');
+
+ $downloadedPackage = DownloadedPackage::fromPackageAndExtractedPath($package, $extractedSourcePath);
+
+ self::assertSame($extractedSourcePath . DIRECTORY_SEPARATOR . 'package-1.2.3', $downloadedPackage->extractedSourcePath);
+ self::assertSame($package, $downloadedPackage->package);
+ }
+
+ public function testBuildPathDetectedFromExtractedPrePackagedSourceAsset(): void
+ {
+ $composerPackage = $this->createMock(CompletePackage::class);
+ $composerPackage->method('getPrettyName')->willReturn('foo/bar');
+ $composerPackage->method('getPrettyVersion')->willReturn('1.2.3');
+ $composerPackage->method('getType')->willReturn('php-ext');
+
+ $package = Package::fromComposerCompletePackage($composerPackage);
+
+ $extractedSourcePath = realpath(__DIR__ . '/../../assets');
+
+ $downloadedPackage = DownloadedPackage::fromPackageAndExtractedPath($package, $extractedSourcePath);
+
+ self::assertSame($extractedSourcePath . DIRECTORY_SEPARATOR . 'php_bar-1.2.3-src', $downloadedPackage->extractedSourcePath);
+ self::assertSame($package, $downloadedPackage->package);
+ }
}
diff --git a/test/unit/Downloading/Exception/CouldNotFindReleaseAssetTest.php b/test/unit/Downloading/Exception/CouldNotFindReleaseAssetTest.php
index e25bcecb..86718a89 100644
--- a/test/unit/Downloading/Exception/CouldNotFindReleaseAssetTest.php
+++ b/test/unit/Downloading/Exception/CouldNotFindReleaseAssetTest.php
@@ -30,13 +30,6 @@ public function testForPackage(): void
'foo/bar',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
);
$exception = CouldNotFindReleaseAsset::forPackage($package, ['something.zip', 'something2.zip']);
@@ -53,13 +46,6 @@ public function testForPackageWithMissingTag(): void
'foo/bar',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
);
$exception = CouldNotFindReleaseAsset::forPackageWithMissingTag($package);
diff --git a/test/unit/Downloading/GithubPackageReleaseAssetsTest.php b/test/unit/Downloading/GithubPackageReleaseAssetsTest.php
index 34d8e25a..58b99b16 100644
--- a/test/unit/Downloading/GithubPackageReleaseAssetsTest.php
+++ b/test/unit/Downloading/GithubPackageReleaseAssetsTest.php
@@ -21,6 +21,7 @@
use Php\Pie\Platform\TargetPlatform;
use Php\Pie\Platform\ThreadSafetyMode;
use Php\Pie\Platform\WindowsCompiler;
+use Php\Pie\Platform\WindowsExtensionAssetName;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
@@ -78,18 +79,23 @@ public function testUrlIsReturnedWhenFindingWindowsDownloadUrl(): void
'asgrim/example-pie-extension',
'1.2.3',
'https://test-uri/' . uniqid('downloadUrl', true),
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
);
$releaseAssets = new GithubPackageReleaseAssets('https://test-github-api-base-url.thephp.foundation');
- self::assertSame('actual_download_url', $releaseAssets->findWindowsDownloadUrlForPackage($targetPlatform, $package, $authHelper, $httpDownloader));
+ self::assertSame(
+ 'actual_download_url',
+ $releaseAssets->findMatchingReleaseAssetUrl(
+ $targetPlatform,
+ $package,
+ $authHelper,
+ $httpDownloader,
+ WindowsExtensionAssetName::zipNames(
+ $targetPlatform,
+ $package,
+ ),
+ ),
+ );
}
public function testUrlIsReturnedWhenFindingWindowsDownloadUrlWithCompilerAndThreadSafetySwapped(): void
@@ -141,18 +147,23 @@ public function testUrlIsReturnedWhenFindingWindowsDownloadUrlWithCompilerAndThr
'asgrim/example-pie-extension',
'1.2.3',
'https://test-uri/' . uniqid('downloadUrl', true),
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
);
$releaseAssets = new GithubPackageReleaseAssets('https://test-github-api-base-url.thephp.foundation');
- self::assertSame('actual_download_url', $releaseAssets->findWindowsDownloadUrlForPackage($targetPlatform, $package, $authHelper, $httpDownloader));
+ self::assertSame(
+ 'actual_download_url',
+ $releaseAssets->findMatchingReleaseAssetUrl(
+ $targetPlatform,
+ $package,
+ $authHelper,
+ $httpDownloader,
+ WindowsExtensionAssetName::zipNames(
+ $targetPlatform,
+ $package,
+ ),
+ ),
+ );
}
public function testFindWindowsDownloadUrlForPackageThrowsExceptionWhenAssetNotFound(): void
@@ -185,18 +196,20 @@ public function testFindWindowsDownloadUrlForPackageThrowsExceptionWhenAssetNotF
'asgrim/example-pie-extension',
'1.2.3',
'https://test-uri/' . uniqid('downloadUrl', true),
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
);
$releaseAssets = new GithubPackageReleaseAssets('https://test-github-api-base-url.thephp.foundation');
$this->expectException(CouldNotFindReleaseAsset::class);
- $releaseAssets->findWindowsDownloadUrlForPackage($targetPlatform, $package, $authHelper, $httpDownloader);
+ $releaseAssets->findMatchingReleaseAssetUrl(
+ $targetPlatform,
+ $package,
+ $authHelper,
+ $httpDownloader,
+ WindowsExtensionAssetName::zipNames(
+ $targetPlatform,
+ $package,
+ ),
+ );
}
}
diff --git a/test/unit/Installing/Ini/AddExtensionToTheIniFileTest.php b/test/unit/Installing/Ini/AddExtensionToTheIniFileTest.php
index 3f6f3f2e..66820d77 100644
--- a/test/unit/Installing/Ini/AddExtensionToTheIniFileTest.php
+++ b/test/unit/Installing/Ini/AddExtensionToTheIniFileTest.php
@@ -63,13 +63,6 @@ public function testReturnsFalseWhenFileIsNotWritable(): void
'foo/bar',
'1.0.0',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
$this->mockPhpBinary,
$this->output,
@@ -107,13 +100,6 @@ public function testReturnsFalseWhenExistingIniCouldNotBeRead(): void
'foo/bar',
'1.0.0',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
$this->mockPhpBinary,
$this->output,
@@ -161,13 +147,6 @@ public function testReturnsFalseWhenExtensionWasAddedButPhpRuntimeDidNotLoadExte
'foo/bar',
'1.0.0',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
$this->mockPhpBinary,
$this->output,
@@ -205,13 +184,6 @@ public function testReturnsTrueWhenExtensionAdded(): void
'foo/bar',
'1.0.0',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
$this->mockPhpBinary,
$this->output,
@@ -221,7 +193,7 @@ public function testReturnsTrueWhenExtensionAdded(): void
$iniContent = file_get_contents($iniFile);
self::assertSame(
PHP_EOL . '; PIE automatically added this to enable the foo/bar extension' . PHP_EOL
- . '; priority=99' . PHP_EOL
+ . '; priority=80' . PHP_EOL
. 'extension=foobar' . PHP_EOL,
$iniContent,
);
@@ -255,13 +227,6 @@ public function testReturnsTrueWhenExtensionAddedWithAdditionalStep(): void
'foo/bar',
'1.0.0',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
$this->mockPhpBinary,
$this->output,
@@ -277,7 +242,7 @@ static function () use (&$additionalStepInvoked): bool {
$iniContent = file_get_contents($iniFile);
self::assertSame(
PHP_EOL . '; PIE automatically added this to enable the foo/bar extension' . PHP_EOL
- . '; priority=99' . PHP_EOL
+ . '; priority=80' . PHP_EOL
. 'extension=foobar' . PHP_EOL,
$iniContent,
);
diff --git a/test/unit/Installing/Ini/CheckAndAddExtensionToIniIfNeededTest.php b/test/unit/Installing/Ini/CheckAndAddExtensionToIniIfNeededTest.php
index ac31ecc2..b7ae9a8b 100644
--- a/test/unit/Installing/Ini/CheckAndAddExtensionToIniIfNeededTest.php
+++ b/test/unit/Installing/Ini/CheckAndAddExtensionToIniIfNeededTest.php
@@ -72,13 +72,6 @@ public function setUp(): void
'foo/bar',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 66,
),
'/path/to/extracted/source',
);
@@ -122,16 +115,16 @@ public function testExtensionIsAlreadyEnabledButExtensionDoesNotLoad(): void
$this->isExtensionAlreadyInTheIniFile
->expects(self::once())
->method('__invoke')
- ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName)
+ ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName())
->willReturn(true);
$this->mockPhpBinary
->expects(self::once())
->method('assertExtensionIsLoadedInRuntime')
- ->with($this->downloadedPackage->package->extensionName, $this->output)
+ ->with($this->downloadedPackage->package->extensionName(), $this->output)
->willThrowException(ExtensionIsNotLoaded::fromExpectedExtension(
$this->mockPhpBinary,
- $this->downloadedPackage->package->extensionName,
+ $this->downloadedPackage->package->extensionName(),
));
$this->addExtensionToTheIniFile
@@ -162,13 +155,13 @@ public function testExtensionIsAlreadyEnabledAndExtensionLoaded(): void
$this->isExtensionAlreadyInTheIniFile
->expects(self::once())
->method('__invoke')
- ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName)
+ ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName())
->willReturn(true);
$this->mockPhpBinary
->expects(self::once())
->method('assertExtensionIsLoadedInRuntime')
- ->with($this->downloadedPackage->package->extensionName, $this->output);
+ ->with($this->downloadedPackage->package->extensionName(), $this->output);
$this->addExtensionToTheIniFile
->expects(self::never())
@@ -194,13 +187,13 @@ public function testExtensionIsAlreadyEnabledWithAdditionalStepAndExtensionLoade
$this->isExtensionAlreadyInTheIniFile
->expects(self::once())
->method('__invoke')
- ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName)
+ ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName())
->willReturn(true);
$this->mockPhpBinary
->expects(self::once())
->method('assertExtensionIsLoadedInRuntime')
- ->with($this->downloadedPackage->package->extensionName, $this->output);
+ ->with($this->downloadedPackage->package->extensionName(), $this->output);
$this->addExtensionToTheIniFile
->expects(self::never())
@@ -233,7 +226,7 @@ public function testExtensionIsNotYetAdded(): void
$this->isExtensionAlreadyInTheIniFile
->expects(self::once())
->method('__invoke')
- ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName)
+ ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName())
->willReturn(false);
$this->mockPhpBinary
@@ -265,7 +258,7 @@ public function testExtensionIsNotYetAddedButFailsToBeAdded(): void
$this->isExtensionAlreadyInTheIniFile
->expects(self::once())
->method('__invoke')
- ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName)
+ ->with(self::INI_FILE, $this->downloadedPackage->package->extensionName())
->willReturn(false);
$this->mockPhpBinary
diff --git a/test/unit/Installing/Ini/DockerPhpExtEnableTest.php b/test/unit/Installing/Ini/DockerPhpExtEnableTest.php
index 410190a0..ab407afc 100644
--- a/test/unit/Installing/Ini/DockerPhpExtEnableTest.php
+++ b/test/unit/Installing/Ini/DockerPhpExtEnableTest.php
@@ -70,13 +70,6 @@ public function setUp(): void
'foo/bar',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
'/path/to/extracted/source',
);
@@ -122,7 +115,7 @@ public function testReturnsTrueWhenDockerPhpExtEnableSuccessfullyEnablesExtensio
$this->mockPhpBinary
->expects(self::once())
->method('assertExtensionIsLoadedInRuntime')
- ->with($this->downloadedPackage->package->extensionName, $this->output);
+ ->with($this->downloadedPackage->package->extensionName(), $this->output);
self::assertTrue(
(new DockerPhpExtEnable(self::GOOD_DOCKER_PHP_EXT_ENABLE))
@@ -157,10 +150,10 @@ public function testReturnsFalseWhenDockerPhpExtEnableFailsToAssertExtensionWasE
$this->mockPhpBinary
->expects(self::once())
->method('assertExtensionIsLoadedInRuntime')
- ->with($this->downloadedPackage->package->extensionName, $this->output)
+ ->with($this->downloadedPackage->package->extensionName(), $this->output)
->willThrowException(ExtensionIsNotLoaded::fromExpectedExtension(
$this->mockPhpBinary,
- $this->downloadedPackage->package->extensionName,
+ $this->downloadedPackage->package->extensionName(),
));
self::assertFalse(
diff --git a/test/unit/Installing/Ini/OndrejPhpenmodTest.php b/test/unit/Installing/Ini/OndrejPhpenmodTest.php
index 4fcecb4e..527fe426 100644
--- a/test/unit/Installing/Ini/OndrejPhpenmodTest.php
+++ b/test/unit/Installing/Ini/OndrejPhpenmodTest.php
@@ -83,13 +83,6 @@ public function setUp(): void
'foo/bar',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
'/path/to/extracted/source',
);
diff --git a/test/unit/Installing/Ini/PickBestSetupIniApproachTest.php b/test/unit/Installing/Ini/PickBestSetupIniApproachTest.php
index 07d4bd68..1c35c02d 100644
--- a/test/unit/Installing/Ini/PickBestSetupIniApproachTest.php
+++ b/test/unit/Installing/Ini/PickBestSetupIniApproachTest.php
@@ -97,13 +97,6 @@ public function testVerboseMessageIsEmittedSettingUpWithoutAnyApproaches(): void
'test-vendor/test-package',
'1.2.3',
'https://test-uri/',
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
'/path/to/extracted/source',
),
@@ -139,13 +132,6 @@ public function testWorkingApproachIsUsed(): void
'test-vendor/test-package',
'1.2.3',
'https://test-uri/',
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
'/path/to/extracted/source',
),
@@ -181,13 +167,6 @@ public function testSetupFailsWhenNoApproachesWork(): void
'test-vendor/test-package',
'1.2.3',
'https://test-uri/',
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
'/path/to/extracted/source',
),
diff --git a/test/unit/Installing/Ini/PreCheckExtensionAlreadyLoadedTest.php b/test/unit/Installing/Ini/PreCheckExtensionAlreadyLoadedTest.php
index de1795f3..6435e6bc 100644
--- a/test/unit/Installing/Ini/PreCheckExtensionAlreadyLoadedTest.php
+++ b/test/unit/Installing/Ini/PreCheckExtensionAlreadyLoadedTest.php
@@ -65,13 +65,6 @@ public function setUp(): void
'foo/bar',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
'/path/to/extracted/source',
);
@@ -93,7 +86,7 @@ public function testSetupReturnsTrueWhenExtAlreadyRuntimeLoaded(): void
$this->mockPhpBinary
->expects(self::once())
->method('assertExtensionIsLoadedInRuntime')
- ->with($this->downloadedPackage->package->extensionName, $this->output);
+ ->with($this->downloadedPackage->package->extensionName(), $this->output);
self::assertTrue($this->preCheckExtensionAlreadyLoaded->setup(
$this->targetPlatform,
@@ -108,10 +101,10 @@ public function testSetupReturnsFalseWhenExtIsNotRuntimeLoaded(): void
$this->mockPhpBinary
->expects(self::once())
->method('assertExtensionIsLoadedInRuntime')
- ->with($this->downloadedPackage->package->extensionName, $this->output)
+ ->with($this->downloadedPackage->package->extensionName(), $this->output)
->willThrowException(ExtensionIsNotLoaded::fromExpectedExtension(
$this->mockPhpBinary,
- $this->downloadedPackage->package->extensionName,
+ $this->downloadedPackage->package->extensionName(),
));
self::assertFalse($this->preCheckExtensionAlreadyLoaded->setup(
diff --git a/test/unit/Installing/Ini/StandardAdditionalPhpIniDirectoryTest.php b/test/unit/Installing/Ini/StandardAdditionalPhpIniDirectoryTest.php
index 83f5b9e4..45a073d6 100644
--- a/test/unit/Installing/Ini/StandardAdditionalPhpIniDirectoryTest.php
+++ b/test/unit/Installing/Ini/StandardAdditionalPhpIniDirectoryTest.php
@@ -77,13 +77,6 @@ public function setUp(): void
'foo/bar',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
'/path/to/extracted/source',
);
@@ -163,7 +156,7 @@ public function testReturnsTrueWhenCheckAndAddExtensionIsInvoked(): void
unlink($additionalPhpIniDirectory);
mkdir($additionalPhpIniDirectory, recursive: true);
- $expectedIniFile = $additionalPhpIniDirectory . DIRECTORY_SEPARATOR . '99-foobar.ini';
+ $expectedIniFile = $additionalPhpIniDirectory . DIRECTORY_SEPARATOR . '80-foobar.ini';
$this->mockPhpBinary
->expects(self::once())
@@ -199,7 +192,7 @@ public function testReturnsFalseAndRemovesPieCreatedIniFileWhenCheckAndAddExtens
unlink($additionalPhpIniDirectory);
mkdir($additionalPhpIniDirectory, recursive: true);
- $expectedIniFile = $additionalPhpIniDirectory . DIRECTORY_SEPARATOR . '99-foobar.ini';
+ $expectedIniFile = $additionalPhpIniDirectory . DIRECTORY_SEPARATOR . '80-foobar.ini';
$this->mockPhpBinary
->expects(self::once())
@@ -234,7 +227,7 @@ public function testReturnsFalseAndLeavesNonPieCreatedIniFileWhenCheckAndAddExte
unlink($additionalPhpIniDirectory);
mkdir($additionalPhpIniDirectory, recursive: true);
- $expectedIniFile = $additionalPhpIniDirectory . DIRECTORY_SEPARATOR . '99-foobar.ini';
+ $expectedIniFile = $additionalPhpIniDirectory . DIRECTORY_SEPARATOR . '80-foobar.ini';
touch($expectedIniFile);
$this->mockPhpBinary
diff --git a/test/unit/Installing/Ini/StandardSinglePhpIniTest.php b/test/unit/Installing/Ini/StandardSinglePhpIniTest.php
index 34b19daa..21f47714 100644
--- a/test/unit/Installing/Ini/StandardSinglePhpIniTest.php
+++ b/test/unit/Installing/Ini/StandardSinglePhpIniTest.php
@@ -70,13 +70,6 @@ public function setUp(): void
'foo/bar',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
),
'/path/to/extracted/source',
);
diff --git a/test/unit/Platform/PrePackagedSourceAssetNameTest.php b/test/unit/Platform/PrePackagedSourceAssetNameTest.php
new file mode 100644
index 00000000..5a47f146
--- /dev/null
+++ b/test/unit/Platform/PrePackagedSourceAssetNameTest.php
@@ -0,0 +1,37 @@
+createMock(CompletePackageInterface::class),
+ ExtensionType::PhpModule,
+ ExtensionName::normaliseFromString('foobar'),
+ 'foo/bar',
+ '1.2.3',
+ null,
+ ),
+ ),
+ );
+ }
+}
diff --git a/test/unit/Platform/WindowsExtensionAssetNameTest.php b/test/unit/Platform/WindowsExtensionAssetNameTest.php
index 75e72a6b..77a77764 100644
--- a/test/unit/Platform/WindowsExtensionAssetNameTest.php
+++ b/test/unit/Platform/WindowsExtensionAssetNameTest.php
@@ -49,13 +49,6 @@ public function setUp(): void
'phpf/foo',
'1.2.3',
null,
- [],
- true,
- true,
- null,
- null,
- null,
- 99,
);
}