Skip to content

Commit 0c33ee0

Browse files
authored
Merge pull request #286 from wp-cli/add/phpstan
2 parents 921ec99 + 2efdb95 commit 0c33ee0

File tree

5 files changed

+185
-126
lines changed

5 files changed

+185
-126
lines changed

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
"wp-cli/db-command": "^1.3 || ^2",
2121
"wp-cli/entity-command": "^1.3 || ^2",
2222
"wp-cli/extension-command": "^1.2 || ^2",
23-
"wp-cli/wp-cli-tests": "^4"
23+
"wp-cli/wp-cli-tests": "^5"
2424
},
2525
"config": {
2626
"process-timeout": 7200,
2727
"sort-packages": true,
2828
"allow-plugins": {
2929
"dealerdirect/phpcodesniffer-composer-installer": true,
30-
"johnpbloch/wordpress-core-installer": true
30+
"johnpbloch/wordpress-core-installer": true,
31+
"phpstan/extension-installer": true
3132
},
3233
"lock": false
3334
},
@@ -64,12 +65,14 @@
6465
"behat-rerun": "rerun-behat-tests",
6566
"lint": "run-linter-tests",
6667
"phpcs": "run-phpcs-tests",
68+
"phpstan": "run-phpstan-tests",
6769
"phpcbf": "run-phpcbf-cleanup",
6870
"phpunit": "run-php-unit-tests",
6971
"prepare-tests": "install-package-tests",
7072
"test": [
7173
"@lint",
7274
"@phpcs",
75+
"@phstan",
7376
"@phpunit",
7477
"@behat"
7578
]

features/core-update.feature

Lines changed: 18 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,42 @@
11
Feature: Update WordPress core
22

3-
# This test downgrades to an older WordPress version, but the SQLite plugin requires 6.0+
3+
# This test downgrades to an older WordPress version, but the SQLite plugin requires 6.4+
44
@require-mysql
55
Scenario: Update from a ZIP file
66
Given a WP install
77
And I try `wp theme install twentytwenty --activate`
88

9-
When I run `wp core download --version=3.9 --force`
9+
When I run `wp core download --version=6.2 --force`
1010
Then STDOUT should not be empty
1111

12-
When I run `wp eval 'echo $GLOBALS["wp_version"];'`
12+
When I try `wp eval 'echo $GLOBALS["wp_version"];'`
1313
Then STDOUT should be:
1414
"""
15-
3.9
15+
6.2
1616
"""
1717

18-
When I run `wget http://wordpress.org/wordpress-4.0.zip --quiet`
19-
And I run `wp core update wordpress-4.0.zip`
18+
When I run `wget http://wordpress.org/wordpress-6.2.zip --quiet`
19+
And I run `wp core update wordpress-6.2.zip`
2020
Then STDOUT should be:
2121
"""
2222
Starting update...
2323
Unpacking the update...
24-
Cleaning up files...
25-
No files found that need cleaning up.
26-
Success: WordPress updated successfully.
27-
"""
28-
29-
When I run `wp eval 'echo $GLOBALS["wp_version"];'`
30-
Then STDOUT should be:
31-
"""
32-
4.0
33-
"""
34-
35-
# PHP 7.1 needs WP 3.9 (due to wp_check_php_mysql_versions(), see trac changeset [27257]),
36-
# and travis doesn't install mysql extension by default for PHP 7.0.
37-
@less-than-php-7
38-
Scenario: Update to the latest minor release
39-
Given a WP install
40-
And I try `wp theme install twentytwenty --activate`
41-
42-
When I run `wp core download --version=4.1 --force`
43-
Then STDOUT should not be empty
44-
45-
# WP core throws notice for PHP 8+.
46-
When I try `wp core update --minor`
47-
Then STDOUT should contain:
48-
"""
49-
Updating to version {WP_VERSION-4.1-latest}
50-
"""
51-
And STDOUT should contain:
52-
"""
5324
Success: WordPress updated successfully.
5425
"""
5526

56-
When I run `wp core update --minor`
57-
Then STDOUT should be:
58-
"""
59-
Success: WordPress is at the latest minor release.
60-
"""
61-
62-
When I run `wp core version`
27+
When I try `wp eval 'echo $GLOBALS["wp_version"];'`
6328
Then STDOUT should be:
6429
"""
65-
{WP_VERSION-4.1-latest}
30+
6.2
6631
"""
6732

68-
# This test downgrades to an older WordPress version, but the SQLite plugin requires 6.0+
33+
# This test downgrades to an older WordPress version, but the SQLite plugin requires 6.4+
6934
@require-mysql
70-
Scenario: Update to the latest minor release (PHP 7.1 compatible with WP >= 3.9)
35+
Scenario: Update to the latest minor release (PHP 7.2 compatible with WP >= 4.9)
7136
Given a WP install
7237
And I try `wp theme install twentytwenty --activate`
7338

74-
When I run `wp core download --version=4.1.30 --force`
39+
When I run `wp core download --version=6.2.5 --force`
7540
Then STDOUT should contain:
7641
"""
7742
Success: WordPress downloaded.
@@ -81,7 +46,7 @@ Feature: Update WordPress core
8146
When I try `wp core update --minor`
8247
Then STDOUT should contain:
8348
"""
84-
Updating to version {WP_VERSION-4.1-latest}
49+
Updating to version {WP_VERSION-6.2-latest}
8550
"""
8651
And STDOUT should contain:
8752
"""
@@ -98,17 +63,17 @@ Feature: Update WordPress core
9863
When I run `wp core version`
9964
Then STDOUT should be:
10065
"""
101-
{WP_VERSION-4.1-latest}
66+
{WP_VERSION-6.2-latest}
10267
"""
10368

104-
# This test downgrades to an older WordPress version, but the SQLite plugin requires 6.0+
69+
# This test downgrades to an older WordPress version, but the SQLite plugin requires 6.4+
10570
@require-mysql
10671
Scenario: Core update from cache
10772
Given a WP install
10873
And I try `wp theme install twentytwenty --activate`
10974
And an empty cache
11075

111-
When I run `wp core update --version=3.9.1 --force`
76+
When I run `wp core update --version=6.2.5 --force`
11277
Then STDOUT should not contain:
11378
"""
11479
Using cached file
@@ -118,13 +83,13 @@ Feature: Update WordPress core
11883
Downloading
11984
"""
12085

121-
When I run `wp core update --version=4.0 --force`
86+
When I run `wp core update --version=6.0 --force`
12287
Then STDOUT should not be empty
12388

124-
When I run `wp core update --version=3.9.1 --force`
89+
When I run `wp core update --version=6.2.5 --force`
12590
Then STDOUT should contain:
12691
"""
127-
Using cached file '{SUITE_CACHE_DIR}/core/wordpress-3.9.1-en_US.zip'...
92+
Using cached file '{SUITE_CACHE_DIR}/core/wordpress-6.2.5-en_US.zip'...
12893
"""
12994
And STDOUT should not contain:
13095
"""

phpstan.neon.dist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
parameters:
2+
level: 9
3+
paths:
4+
- src
5+
- core-command.php
6+
scanDirectories:
7+
- vendor/wp-cli/wp-cli/php
8+
scanFiles:
9+
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
10+
treatPhpDocTypesAsCertain: false
11+
ignoreErrors:
12+
- identifier: missingType.iterableValue
13+
- identifier: missingType.parameter
14+
- identifier: missingType.return

0 commit comments

Comments
 (0)