Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt package structure #165

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0fefa8c
Adapt branch alias to change from master to main
schlessera Jan 13, 2022
646a8c1
Update package structure
schlessera Jan 13, 2022
8526659
Adapt tests
schlessera Jan 13, 2022
b9ff6ff
Merge branch 'main' into fix/adapt-branch-alias
swissspidy Nov 2, 2023
c91e0fd
Update error message
swissspidy Nov 2, 2023
7f23150
Fix namespace
swissspidy Nov 2, 2023
428e472
Use const from base class
swissspidy Nov 2, 2023
929a923
Make test more robust
swissspidy Nov 3, 2023
ac7a242
Update tests
swissspidy Nov 3, 2023
71887de
Change version
swissspidy Nov 3, 2023
e652614
Update tests
swissspidy Nov 3, 2023
ff7e752
Use twentytwenty which is available on 5.9
swissspidy Nov 3, 2023
3dbb22a
Make tests more robust
swissspidy Nov 3, 2023
afca8a4
Fix typo
swissspidy Nov 3, 2023
817fd19
Skip test
swissspidy Nov 3, 2023
5e2953e
Increase threshold
swissspidy Nov 3, 2023
b653227
Reduce threshold
swissspidy Nov 3, 2023
c05a19f
Fix alignment
swissspidy Nov 3, 2023
8f1935c
Remove unused var
swissspidy Nov 3, 2023
d9928e0
Add missing arg
swissspidy Nov 3, 2023
6ab4e4d
Replace var
swissspidy Nov 3, 2023
e27c3b9
List network-active plugins
swissspidy Nov 3, 2023
0fa8a7c
Update tests
swissspidy Nov 3, 2023
9607277
Fix property name
swissspidy Nov 4, 2023
e514ffe
Rename classes to add back underscores
swissspidy Nov 4, 2023
e899630
Run `wp core update`
swissspidy Nov 6, 2023
2dcfb1c
Update another test
swissspidy Nov 6, 2023
f07dd9c
Remove step again
swissspidy Nov 6, 2023
1ede25a
Only _try_ update
swissspidy Nov 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
default:
suites:
default:
contexts:
- WP_CLI\Tests\Context\FeatureContext
paths:
- features
14 changes: 3 additions & 11 deletions bin/readme/installing-body.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
`wp doctor` is available to [runcommand gold and silver subscribers](https://runcommand.io/pricing/).
You can install the `wp-cli/doctor-command` package via the following command:

Once you've signed up, you can [download the latest version](https://runcommand.memberful.com/account/downloads) from your account dashboard. Then, install `wp doctor` with:

```
$ wp package install doctor.zip
```

If you have a Github developer seat, you can also run:

```
$ wp package install git@github.com:runcommand/doctor.git
```bash
wp package install wp-cli/doctor-command
```
27 changes: 0 additions & 27 deletions command.php

This file was deleted.

10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
"wp-cli/wp-cli-tests": "^4"
},
"config": {
"platform": {
"php": "5.6"
},
"process-timeout": 7200,
"sort-packages": true,
"allow-plugins": {
Expand All @@ -36,7 +33,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
"dev-main": "2.x-dev"
},
"commands": [
"doctor check",
Expand All @@ -55,8 +52,11 @@
}
},
"autoload": {
"psr-4": {
"WP_CLI\\Doctor\\": "src/"
},
"files": [
"command.php"
"doctor-command.php"
]
},
"minimum-stability": "dev",
Expand Down
13 changes: 13 additions & 0 deletions doctor-command.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

if ( ! class_exists( 'WP_CLI' ) ) {
return;
}

$wpcli_doctor_autoloader = __DIR__ . '/vendor/autoload.php';

if ( file_exists( $wpcli_doctor_autoloader ) ) {
require_once $wpcli_doctor_autoloader;
}

WP_CLI::add_command( 'doctor', 'WP_CLI\Doctor\Command' );
32 changes: 16 additions & 16 deletions doctor.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
# Default check configuration for `wp doctor`
autoload-options-size:
check: Autoload_Options_Size
check: AutoloadOptionsSize
constant-savequeries-falsy:
check: Constant_Definition
check: ConstantDefinition
options:
constant: SAVEQUERIES
falsy: true
constant-wp-debug-falsy:
check: Constant_Definition
check: ConstantDefinition
options:
constant: WP_DEBUG
falsy: true
core-update:
check: Core_Update
check: CoreUpdate
core-verify-checksums:
check: Core_Verify_Checksums
check: CoreVerifyChecksums
cron-count:
check: Cron_Count
check: CronCount
cron-duplicates:
check: Cron_Duplicates
check: CronDuplicates
file-eval:
check: File_Contents
check: FileContents
options:
regex: eval\(.*base64_decode\(.*
option-blog-public:
check: Option_Value
check: OptionValue
options:
option: blog_public
value: 1
plugin-active-count:
check: Plugin_Active_Count
check: PluginActiveCount
plugin-deactivated:
check: Plugin_Deactivated
check: PluginDeactivated
plugin-update:
check: Plugin_Update
check: PluginUpdate
theme-update:
check: Theme_Update
check: ThemeUpdate
cache-flush:
check: Cache_Flush
check: CacheFlush
php-in-upload:
check: PHP_In_Upload
check: PHPInUpload
language-update:
check: Language_Update
check: LanguageUpdate
swissspidy marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion features/check-autoload-options-size.feature
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Feature: Check the size of autoloaded options
And a custom.yml file:
"""
autoload-options-size:
class: runcommand\Doctor\Checks\Autoload_Options_Size
class: WP_CLI\Doctor\Check\AutoloadOptionsSize
options:
threshold_kb: 800
"""
Expand Down
6 changes: 3 additions & 3 deletions features/check-constant-definition.feature
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Feature: Check the values of defined constants
And a config.yml file:
"""
constant-db-host-defined:
class: runcommand\Doctor\Checks\Constant_Definition
class: WP_CLI\Doctor\Check\ConstantDefinition
options:
constant: DB_HOST
defined: true
Expand All @@ -87,7 +87,7 @@ Feature: Check the values of defined constants
And a config.yml file:
"""
constant-foobar-true:
class: runcommand\Doctor\Checks\Constant_Definition
class: WP_CLI\Doctor\Check\ConstantDefinition
options:
constant: FOOBAR
value: true
Expand All @@ -108,7 +108,7 @@ Feature: Check the values of defined constants
And a config.yml file:
"""
constant-foobar-true:
class: runcommand\Doctor\Checks\Constant_Definition
class: WP_CLI\Doctor\Check\ConstantDefinition
options:
constant: FOOBAR
value: true
Expand Down
13 changes: 9 additions & 4 deletions features/check-core-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Feature: Check whether WordPress is up to date
| name | description |
| core-update | Errors when new WordPress minor release is available; warns for major release. |

@require-wp-latest
Scenario: WordPress is up to date
Given a WP install

Expand All @@ -16,10 +17,12 @@ Feature: Check whether WordPress is up to date
| name | status | message |
| core-update | success | WordPress is at the latest version. |

# This test downgrades to WordPress 5.9.1, but the SQLite plugin requires 6.0+
@requires-mysql
Scenario: WordPress has a new minor version but no new major version
Given a WP install
And I run `wp core download --version=4.5.1 --force`
And I run `wp theme activate twentyfifteen`
And I run `wp core download --version=5.9.1 --force`
And I run `wp theme activate twentytwenty`

When I try `wp doctor check core-update`
Then STDOUT should be a table containing rows:
Expand All @@ -31,10 +34,12 @@ Feature: Check whether WordPress is up to date
"""
And the return code should be 1

# This test downgrades to WordPress 5.9.1, but the SQLite plugin requires 6.0+
@requires-mysql
Scenario: WordPress has a new major version but no new minor version
Given a WP install
And I run `wp core download --version=4.4.9 --force`
And I run `wp theme activate twentyfifteen`
And I run `wp core download --version=5.9.1 --force`
And I run `wp theme activate twentytwenty`

When I try `wp doctor check core-update`
Then STDOUT should be a table containing rows:
Expand Down
8 changes: 4 additions & 4 deletions features/check-file-contents.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Feature: Check files in a WordPress install
Given a wp-content/mu-plugins/exploited.php file:
"""
<?php
eval( base64_decode( $_POST ) );
eval( base64_decode( isset( $_POST[''] ) ? $_POST[''] : '' ) );
"""

When I try `wp doctor check file-eval`
Expand All @@ -37,7 +37,7 @@ Feature: Check files in a WordPress install
And a config.yml file:
"""
file-sessions:
check: File_Contents
check: FileContents
options:
regex: .*(session_start|\$_SESSION).*
only_wp_content: true
Expand Down Expand Up @@ -74,7 +74,7 @@ Feature: Check files in a WordPress install
And a config.yml file:
"""
file-server-name-wp-config:
check: File_Contents
check: FileContents
options:
regex: define\(.+WP_(HOME|SITEURL).+\$_SERVER.+SERVER_NAME
path: wp-config.php
Expand Down Expand Up @@ -122,7 +122,7 @@ Feature: Check files in a WordPress install
And a config.yml file:
"""
file-content-exist:
check: File_Contents
check: FileContents
options:
regex: .*wp-doctor-exists-test.*
only_wp_content: true
Expand Down
4 changes: 2 additions & 2 deletions features/check-file-type.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: Check the type of file
And a config.yml file:
"""
file-object-cache-symlink:
check: File_Type
check: FileType
options:
path: wp-content/object-cache.php
symlink: false
Expand Down Expand Up @@ -38,7 +38,7 @@ Feature: Check the type of file
And a config.yml file:
"""
file-object-cache-symlink:
check: File_Type
check: FileType
options:
path: wp-content/object-cache.php
symlink: true
Expand Down
1 change: 1 addition & 0 deletions features/check-language-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Feature: Check whether languages are up to date

When I run `wp language core install ja`
And I run `cat wp-content/languages/custom.po > wp-content/languages/ja.po`
And I run `cat wp-content/languages/custom.po > wp-content/languages/admin-ja.po`

When I run `wp doctor check language-update`
Then STDOUT should be a table containing rows:
Expand Down
12 changes: 6 additions & 6 deletions features/check-option-value.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Feature: Check the value of a given option
And a blog-private.yml file:
"""
option-blog-private:
check: Option_Value
check: OptionValue
options:
option: blog_public
value: 0
"""
And a blog-public.yml file:
"""
option-blog-public:
check: Option_Value
check: OptionValue
options:
option: blog_public
value: 1
Expand Down Expand Up @@ -74,7 +74,7 @@ Feature: Check the value of a given option
And a config.yml file:
"""
option-admin-email:
check: Option_Value
check: OptionValue
options:
option: admin_email
value: foo@example.org
Expand Down Expand Up @@ -106,7 +106,7 @@ Feature: Check the value of a given option
And a config.yml file:
"""
option-admin-email:
check: Option_Value
check: OptionValue
options:
option: admin_email
value_is_not: foo@example.org
Expand Down Expand Up @@ -139,7 +139,7 @@ Feature: Check the value of a given option
And a config.yml file:
"""
option-users-can-register:
check: Option_Value
check: OptionValue
options:
option: users_can_register
value: 0
Expand Down Expand Up @@ -172,7 +172,7 @@ Feature: Check the value of a given option
And a config.yml file:
"""
option-users-can-register:
check: Option_Value
check: OptionValue
options:
option: users_can_register
value: 0
Expand Down
Loading
Loading