Merge pull request #354 from wp-cli/dependabot/composer/wp-cli/wp-cli-tests-tw-5

This commit is contained in:
Pascal Birchler 2025-07-04 11:36:46 +02:00 committed by GitHub
commit 28abef8ddc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 6 deletions

View file

@ -16,14 +16,15 @@
},
"require-dev": {
"wp-cli/extension-command": "^1.2 || ^2",
"wp-cli/wp-cli-tests": "^4"
"wp-cli/wp-cli-tests": "^5"
},
"config": {
"process-timeout": 7200,
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"johnpbloch/wordpress-core-installer": true
"johnpbloch/wordpress-core-installer": true,
"phpstan/extension-installer": true
},
"lock": false
},
@ -59,12 +60,14 @@
"behat-rerun": "rerun-behat-tests",
"lint": "run-linter-tests",
"phpcs": "run-phpcs-tests",
"phpstan": "run-phpstan-tests",
"phpcbf": "run-phpcbf-cleanup",
"phpunit": "run-php-unit-tests",
"prepare-tests": "install-package-tests",
"test": [
"@lint",
"@phpcs",
"@phpstan",
"@phpunit",
"@behat"
]

View file

@ -231,7 +231,7 @@ Feature: WordPress code scaffolding
"""
And the {PLUGIN_DIR}/hello-world/.phpcs.xml.dist file should contain:
"""
<config name="testVersion" value="5.6-"/>
<config name="testVersion" value="7.2-"/>
"""
And the {PLUGIN_DIR}/hello-world/hello-world.php file should contain:
"""

13
phpstan.neon.dist Normal file
View file

@ -0,0 +1,13 @@
parameters:
level: 9
paths:
- src
- scaffold-command.php
scanDirectories:
- vendor/wp-cli/wp-cli/php
scanFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
treatPhpDocTypesAsCertain: false
ignoreErrors:
- identifier: missingType.parameter
- identifier: missingType.return

View file

@ -875,7 +875,7 @@ class Scaffold_Command extends WP_CLI_Command {
$wp_versions_to_test = [];
// Parse plugin readme.txt
if ( file_exists( "{$target_dir}/readme.txt" ) ) {
$readme_content = file_get_contents( "{$target_dir}/readme.txt" );
$readme_content = (string) file_get_contents( "{$target_dir}/readme.txt" );

preg_match( '/Requires at least\:(.*)\n/m', $readme_content, $matches );
if ( isset( $matches[1] ) && $matches[1] ) {
@ -1045,7 +1045,7 @@ class Scaffold_Command extends WP_CLI_Command {
/**
* Extracts dashicon name when provided or return null otherwise.
*
* @param array $assoc_args
* @param array{dashicon?: string} $assoc_args
* @return string|null
*/
private function extract_dashicon( $assoc_args ) {

View file

@ -18,7 +18,7 @@

<!-- Rules: Check PHP version compatibility -->
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="5.6-"/>
<config name="testVersion" value="7.2-"/>
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<rule ref="PHPCompatibilityWP"/>