diff --git a/composer.lock b/composer.lock index 63695b668..b1afe9d34 100644 --- a/composer.lock +++ b/composer.lock @@ -1098,87 +1098,6 @@ ], "time": "2023-05-02T15:15:43+00:00" }, - { - "name": "rmccue/requests", - "version": "v2.0.6", - "source": { - "type": "git", - "url": "https://github.com/WordPress/Requests.git", - "reference": "7d0f8394ea7846a7086978318c306123118445dc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/WordPress/Requests/zipball/7d0f8394ea7846a7086978318c306123118445dc", - "reference": "7d0f8394ea7846a7086978318c306123118445dc", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": ">=5.6" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", - "php-parallel-lint/php-console-highlighter": "^0.5.0", - "php-parallel-lint/php-parallel-lint": "^1.3.1", - "phpcompatibility/php-compatibility": "^9.0", - "requests/test-server": "dev-main", - "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.6", - "wp-coding-standards/wpcs": "^2.0", - "yoast/phpunit-polyfills": "^1.0.0" - }, - "type": "library", - "autoload": { - "files": [ - "library/Deprecated.php" - ], - "psr-4": { - "WpOrg\\Requests\\": "src/" - }, - "classmap": [ - "library/Requests.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Ryan McCue", - "homepage": "https://rmccue.io/" - }, - { - "name": "Alain Schlesser", - "homepage": "https://github.com/schlessera" - }, - { - "name": "Juliette Reinders Folmer", - "homepage": "https://github.com/jrfnl" - }, - { - "name": "Contributors", - "homepage": "https://github.com/WordPress/Requests/graphs/contributors" - } - ], - "description": "A HTTP library written in PHP, for human beings.", - "homepage": "https://requests.ryanmccue.info/", - "keywords": [ - "curl", - "fsockopen", - "http", - "idna", - "ipv6", - "iri", - "sockets" - ], - "support": { - "docs": "https://requests.ryanmccue.info/", - "issues": "https://github.com/WordPress/Requests/issues", - "source": "https://github.com/WordPress/Requests" - }, - "time": "2023-04-04T09:01:49+00:00" - }, { "name": "seld/jsonlint", "version": "1.10.0", @@ -3088,22 +3007,22 @@ }, { "name": "wp-cli/package-command", - "version": "v2.3.0", + "version": "v2.3.2", "source": { "type": "git", "url": "https://github.com/wp-cli/package-command.git", - "reference": "7b01ba9f858917ac7d103aef83da07ad87944019" + "reference": "88b7728c81105be91f1e1aabbdf3b4037999b5bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/package-command/zipball/7b01ba9f858917ac7d103aef83da07ad87944019", - "reference": "7b01ba9f858917ac7d103aef83da07ad87944019", + "url": "https://api.github.com/repos/wp-cli/package-command/zipball/88b7728c81105be91f1e1aabbdf3b4037999b5bd", + "reference": "88b7728c81105be91f1e1aabbdf3b4037999b5bd", "shasum": "" }, "require": { "composer/composer": "^1.10.23 || ~2.2.17", "ext-json": "*", - "wp-cli/wp-cli": "dev-main as 2.8.x-dev" + "wp-cli/wp-cli": "^2.8" }, "require-dev": { "wp-cli/scaffold-command": "^1 || ^2", @@ -3147,9 +3066,9 @@ "homepage": "https://github.com/wp-cli/package-command", "support": { "issues": "https://github.com/wp-cli/package-command/issues", - "source": "https://github.com/wp-cli/package-command/tree/v2.3.0" + "source": "https://github.com/wp-cli/package-command/tree/v2.3.2" }, - "time": "2023-05-12T14:57:18+00:00" + "time": "2023-06-02T06:17:19+00:00" }, { "name": "wp-cli/php-cli-tools", @@ -3409,16 +3328,16 @@ }, { "name": "wp-cli/search-replace-command", - "version": "v2.1.0", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/wp-cli/search-replace-command.git", - "reference": "c23820436dcac45662e7a6833bbdfa542b0f21a0" + "reference": "1d5c77fbead033a7707915fa0c51306fb3c64d37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/search-replace-command/zipball/c23820436dcac45662e7a6833bbdfa542b0f21a0", - "reference": "c23820436dcac45662e7a6833bbdfa542b0f21a0", + "url": "https://api.github.com/repos/wp-cli/search-replace-command/zipball/1d5c77fbead033a7707915fa0c51306fb3c64d37", + "reference": "1d5c77fbead033a7707915fa0c51306fb3c64d37", "shasum": "" }, "require": { @@ -3463,9 +3382,9 @@ "homepage": "https://github.com/wp-cli/search-replace-command", "support": { "issues": "https://github.com/wp-cli/search-replace-command/issues", - "source": "https://github.com/wp-cli/search-replace-command/tree/v2.1.0" + "source": "https://github.com/wp-cli/search-replace-command/tree/v2.1.1" }, - "time": "2023-05-11T08:09:28+00:00" + "time": "2023-06-02T20:30:01+00:00" }, { "name": "wp-cli/server-command", @@ -3716,19 +3635,18 @@ "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "5274e68d439df060873bdc9fa3e486d4aeeddf6e" + "reference": "47d97e5bdc7b95533c182630c458cada7e615fda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/5274e68d439df060873bdc9fa3e486d4aeeddf6e", - "reference": "5274e68d439df060873bdc9fa3e486d4aeeddf6e", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/47d97e5bdc7b95533c182630c458cada7e615fda", + "reference": "47d97e5bdc7b95533c182630c458cada7e615fda", "shasum": "" }, "require": { "ext-curl": "*", "mustache/mustache": "^2.14.1", "php": "^5.6 || ^7.0 || ^8.0", - "rmccue/requests": "^2", "symfony/finder": ">2.7", "wp-cli/mustangostang-spyc": "^0.6.3", "wp-cli/php-cli-tools": "~0.11.2" @@ -3780,7 +3698,7 @@ "issues": "https://github.com/wp-cli/wp-cli/issues", "source": "https://github.com/wp-cli/wp-cli" }, - "time": "2023-05-31T19:27:42+00:00" + "time": "2023-06-03T04:08:28+00:00" }, { "name": "wp-cli/wp-config-transformer", @@ -5151,12 +5069,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "e7a16840e9d12291c351fee9896838900f534d68" + "reference": "0feb297cb2162446e9d3334cd131d861d7d2d997" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/e7a16840e9d12291c351fee9896838900f534d68", - "reference": "e7a16840e9d12291c351fee9896838900f534d68", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/0feb297cb2162446e9d3334cd131d861d7d2d997", + "reference": "0feb297cb2162446e9d3334cd131d861d7d2d997", "shasum": "" }, "conflict": { @@ -5232,7 +5150,7 @@ "contao/core-bundle": "<4.9.40|>=4.10,<4.11.7|>=4.13,<4.13.21|>=5.1,<5.1.4|= 4.10.0", "contao/listing-bundle": ">=4,<4.4.8", "contao/managed-edition": "<=1.5", - "craftcms/cms": ">= 4.0.0-RC1, <= 4.4.5|>= 4.0.0-RC1, <= 4.4.6|<=3.8.5|>=4,<4.4.6|>= 4.0.0-RC1, < 4.4.6|>= 4.0.0-RC1, < 4.3.7|>= 4.0.0-RC1, < 4.2.1", + "craftcms/cms": "<4.4.12|>= 4.0.0-RC1, <= 4.4.5|>= 4.0.0-RC1, <= 4.4.6|>= 4.0.0-RC1, < 4.4.6|>= 4.0.0-RC1, < 4.3.7|>= 4.0.0-RC1, < 4.2.1", "croogo/croogo": "<3.0.7", "cuyz/valinor": "<0.12", "czproject/git-php": "<4.0.3", @@ -5488,7 +5406,7 @@ "pimcore/pimcore": "<10.5.21", "pixelfed/pixelfed": "<=0.11.4", "pocketmine/bedrock-protocol": "<8.0.2", - "pocketmine/pocketmine-mp": "<4.12.5|>= 4.0.0-BETA5, < 4.4.2", + "pocketmine/pocketmine-mp": "< 4.18.0-ALPHA2|<4.12.5|>= 4.0.0-BETA5, < 4.4.2", "pressbooks/pressbooks": "<5.18", "prestashop/autoupgrade": ">=4,<4.10.1", "prestashop/blockwishlist": ">=2,<2.1.1", @@ -5751,7 +5669,7 @@ "type": "tidelift" } ], - "time": "2023-05-31T16:04:38+00:00" + "time": "2023-06-02T23:04:03+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", diff --git a/features/requests.feature b/features/requests.feature index 1bf24ebfe..699694d23 100644 --- a/features/requests.feature +++ b/features/requests.feature @@ -96,3 +96,136 @@ Feature: Requests integration with both v1 and v2 """ Success: Installed 1 of 1 plugins. """ + + Scenario: Composer stack with Requests v1 pulling wp-cli/wp-cli-bundle + Given an empty directory + And a composer.json file: + """ + { + "name": "example/wordpress", + "type": "project", + "extra": { + "wordpress-install-dir": "wp", + "installer-paths": { + "content/plugins/{$name}/": [ + "type:wordpress-plugin" + ], + "content/themes/{$name}/": [ + "type:wordpress-theme" + ] + } + }, + "repositories": [ + { + "type": "composer", + "url": "https://wpackagist.org" + } + ], + "require": { + "johnpbloch/wordpress": "6.1" + }, + "require-dev": { + "wp-cli/wp-cli-bundle": "dev-main as 2.8.1" + }, + "minimum-stability": "dev", + "config": { + "allow-plugins": { + "johnpbloch/wordpress-core-installer": true + } + } + } + """ + # Note: Composer outputs messages to stderr. + And I run `composer install --no-interaction 2>&1` + And a wp-cli.yml file: + """ + path: wp + """ + And an extra-config.php file: + """ + require __DIR__ . "/../vendor/autoload.php"; + """ + And the {RUN_DIR}/vendor/wp-cli/wp-cli/bundle/rmccue/requests directory should exist + And the {RUN_DIR}/vendor/rmccue/requests directory should not exist + + When I run `vendor/bin/wp config create --dbname={DB_NAME} --dbuser={DB_USER} --dbpass={DB_PASSWORD} --dbhost={DB_HOST} --extra-php < extra-config.php` + Then STDOUT should be: + """ + Success: Generated 'wp-config.php' file. + """ + + When I run `vendor/bin/wp config set WP_DEBUG true --raw` + Then STDOUT should be: + """ + Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'true'. + """ + + When I run `vendor/bin/wp config set WP_DEBUG_DISPLAY true --raw` + Then STDOUT should be: + """ + Success: Added the constant 'WP_DEBUG_DISPLAY' to the 'wp-config.php' file with the raw value 'true'. + """ + + When I run `vendor/bin/wp db create` + Then STDOUT should be: + """ + Success: Database created. + """ + + # This can throw deprecated warnings on PHP 8.1+. + When I try `vendor/bin/wp core install --url=localhost:8181 --title=Composer --admin_user=admin --admin_password=password --admin_email=admin@example.com` + Then STDOUT should contain: + """ + Success: WordPress installed successfully. + """ + + When I run `vendor/bin/wp core version` + Then STDOUT should contain: + """ + 6.1 + """ + + # This can throw deprecated warnings on PHP 8.1+. + When I try `vendor/bin/wp eval 'var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );'` + Then STDOUT should contain: + """ + object(Requests_Response) + """ + And STDOUT should contain: + """ + HTTP/1.1 200 OK + """ + + # This can throw deprecated warnings on PHP 8.1+. + When I try `vendor/bin/wp plugin install duplicate-post --activate` + Then STDOUT should contain: + """ + Success: Installed 1 of 1 plugins. + """ + + And I launch in the background `wp server --host=localhost --port=8181` + And I run `wp option set blogdescription 'Just another Composer-based WordPress site'` + + When I run `curl -sS localhost:8181` + Then STDOUT should contain: + """ + Just another Composer-based WordPress site + """ + + When I run `vendor/bin/wp eval 'echo COOKIEHASH;'` + And save STDOUT as {COOKIEHASH} + Then STDOUT should not be empty + + When I run `vendor/bin/wp eval 'echo wp_generate_auth_cookie( 1, 32503680000 );'` + And save STDOUT as {AUTH_COOKIE} + Then STDOUT should not be empty + + When I run `curl -b 'wordpress_{COOKIEHASH}={AUTH_COOKIE}' -sS localhost:8181/wp-admin/plugins.php` + Then STDOUT should contain: + """ + Plugins + """ + And STDOUT should contain: + """ + plugin=duplicate-post + """ diff --git a/utils/make-phar.php b/utils/make-phar.php index 4b31f6424..5417fb127 100644 --- a/utils/make-phar.php +++ b/utils/make-phar.php @@ -190,7 +190,7 @@ function get_composer_versions( $current_version ) { ->in( WP_CLI_BUNDLE_ROOT . '/php' ) ->in( WP_CLI_VENDOR_DIR . '/mustache' ) ->in( WP_CLI_VENDOR_DIR . '/eftec/bladeone' ) - ->in( WP_CLI_VENDOR_DIR . '/rmccue/requests' ) + ->in( WP_CLI_ROOT . '/bundle/rmccue/requests' ) ->in( WP_CLI_VENDOR_DIR . '/composer' ) ->in( WP_CLI_VENDOR_DIR . '/symfony' ) ->notName( 'behat-tags.php' ) @@ -290,7 +290,7 @@ function get_composer_versions( $current_version ) { add_file( $phar, WP_CLI_VENDOR_DIR . '/composer/composer/LICENSE' ); add_file( $phar, WP_CLI_VENDOR_DIR . '/composer/composer/res/composer-schema.json' ); } -add_file( $phar, WP_CLI_VENDOR_DIR . '/rmccue/requests/certificates/cacert.pem' ); +add_file( $phar, WP_CLI_ROOT . '/bundle/rmccue/requests/certificates/cacert.pem' ); set_file_contents( $phar, WP_CLI_ROOT . '/COMPOSER_VERSIONS', get_composer_versions( $current_version ) ); set_file_contents( $phar, WP_CLI_ROOT . '/VERSION', $current_version );