Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion features/config-backcompat.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: Backwards compatibility
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS}`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check`
Then STDOUT should contain:
"""
Generated 'wp-config.php' file.
Expand Down
44 changes: 30 additions & 14 deletions features/config-create.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Feature: Create a wp-config file

# Skipped for SQLite because `wp db create` does not yet support SQLite.
# See https://github.com/wp-cli/db-command/issues/234
# and https://github.com/wp-cli/config-command/issues/167
@require-mysql
Scenario: No wp-config.php
Given an empty directory
And WP files
Expand All @@ -24,7 +28,7 @@ Feature: Create a wp-config file
define( 'WP_DEBUG_LOG', true );
"""

When I run `wp core config {CORE_CONFIG_SETTINGS} --extra-php < wp-config-extra.php`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --extra-php < wp-config-extra.php`
Then the wp-config.php file should contain:
"""
'AUTH_SALT',
Expand All @@ -43,7 +47,7 @@ Feature: Create a wp-config file
define( 'WP_DEBUG_LOG', true );
"""

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
Then the wp-custom-config.php file should contain:
"""
'AUTH_SALT',
Expand Down Expand Up @@ -74,7 +78,7 @@ Feature: Create a wp-config file
define( 'WP_DEBUG', true );
"""

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
When I run `wp config create {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
Then the wp-custom-config.php file should contain:
"""
define( 'WP_DEBUG', true );
Expand All @@ -99,7 +103,7 @@ Feature: Create a wp-config file
define( 'WP_DEBUG_LOG', true );
"""

When I run `wp core config {CORE_CONFIG_SETTINGS} --extra-php < wp-config-extra.php`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --extra-php < wp-config-extra.php`
Then the wp-config.php file should not contain:
"""
define( 'WPLANG', '' );
Expand All @@ -109,7 +113,7 @@ Feature: Create a wp-config file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --skip-salts --extra-php < /dev/null`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --skip-salts --extra-php < /dev/null`
Then the wp-config.php file should not contain:
"""
define('AUTH_SALT',
Expand All @@ -123,33 +127,45 @@ Feature: Create a wp-config file
Given an empty directory
And WP files

When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=sompassword --dbprefix=""`
When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=somepassword --dbprefix=""`
Then the return code should be 1
And STDERR should contain:
"""
Error: --dbprefix cannot be empty
"""

When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=sompassword --dbprefix=" "`
When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=somepassword --dbprefix=" "`
Then the return code should be 1
And STDERR should contain:
"""
Error: --dbprefix can only contain numbers, letters, and underscores.
"""

When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=sompassword --dbprefix="wp-"`
When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=somepassword --dbprefix="wp-"`
Then the return code should be 1
And STDERR should contain:
"""
Error: --dbprefix can only contain numbers, letters, and underscores.
"""

@require-mysql
Scenario: Configure with invalid database credentials
Given an empty directory
And WP files

When I try `wp config create --dbname=somedb --dbuser=someuser --dbpass=somepassword`
Then the return code should be 1
And STDERR should contain:
"""
Error: Database connection error
"""

@require-php-7.0
Scenario: Configure with salts generated
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS}`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check`
Then the wp-config.php file should contain:
"""
define( 'AUTH_SALT',
Expand All @@ -160,7 +176,7 @@ Feature: Create a wp-config file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS}`
When I run `wp config create {CORE_CONFIG_SETTINGS}`
Then the wp-config.php file should contain:
"""
define( 'AUTH_SALT',
Expand All @@ -170,20 +186,20 @@ Feature: Create a wp-config file
Given an empty directory
And I run `wp core download --version=3.9 --force`

When I run `wp core config {CORE_CONFIG_SETTINGS}`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check`
Then the wp-config.php file should contain:
"""
define( 'WPLANG', '' );
"""

When I try `wp core config {CORE_CONFIG_SETTINGS}`
When I try `wp config create {CORE_CONFIG_SETTINGS}`
Then the return code should be 1
And STDERR should contain:
"""
Error: The 'wp-config.php' file already exists.
"""

When I run `wp core config {CORE_CONFIG_SETTINGS} --locale=ja --force`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --locale=ja --force`
Then the return code should be 0
And STDOUT should contain:
"""
Expand All @@ -194,7 +210,7 @@ Feature: Create a wp-config file
define( 'WPLANG', 'ja' );
"""

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file=wp-custom-config.php --locale=ja --force`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file=wp-custom-config.php --locale=ja --force`
Then the return code should be 0
And STDOUT should contain:
"""
Expand Down
6 changes: 3 additions & 3 deletions features/config-delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Feature: Delete a constant or variable from the wp-config.php file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down Expand Up @@ -117,7 +117,7 @@ Feature: Delete a constant or variable from the wp-config.php file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down Expand Up @@ -173,7 +173,7 @@ Feature: Delete a constant or variable from the wp-config.php file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down
2 changes: 1 addition & 1 deletion features/config-edit.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Edit a wp-config file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down
4 changes: 2 additions & 2 deletions features/config-get-field.feature
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Feature: Get the value of a constant or variable defined in wp-config.php and wp
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down Expand Up @@ -269,7 +269,7 @@ Feature: Get the value of a constant or variable defined in wp-config.php and wp
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down
10 changes: 5 additions & 5 deletions features/config-has.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand All @@ -29,11 +29,11 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h
Then STDOUT should be empty
And the return code should be 0

When I run `wp config has DB_USER --type=constant --config-file='wp-custom-config.php'`
When I run `wp config has DB_USER --type=constant --config-file='wp-custom-config.php'`
Then STDOUT should be empty
And the return code should be 0

When I run `wp config has table_prefix --type=variable --config-file='wp-custom-config.php'`
When I run `wp config has table_prefix --type=variable --config-file='wp-custom-config.php'`
Then STDOUT should be empty
And the return code should be 0

Expand Down Expand Up @@ -70,7 +70,7 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down Expand Up @@ -133,7 +133,7 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down
10 changes: 5 additions & 5 deletions features/config-list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: List the values of a wp-config.php file
<?php // This won't work without this file being empty. ?>
"""

When I run `wp core config {CORE_CONFIG_SETTINGS} --extra-php < wp-config-extra.php`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --extra-php < wp-config-extra.php`
Then STDOUT should contain:
"""
Generated 'wp-config.php' file.
Expand Down Expand Up @@ -43,7 +43,7 @@ Feature: List the values of a wp-config.php file
<?php // This won't work without this file being empty. ?>
"""

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand All @@ -66,7 +66,7 @@ Feature: List the values of a wp-config.php file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS}`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check`
Then STDOUT should contain:
"""
Generated 'wp-config.php' file.
Expand Down Expand Up @@ -198,13 +198,13 @@ Feature: List the values of a wp-config.php file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
"""

When I run `wp config list --fields=name --config-file='wp-custom-config.php'`
When I run `wp config list --fields=name --config-file='wp-custom-config.php'`
Then STDOUT should be a table containing rows:
| name |
| table_prefix |
Expand Down
16 changes: 8 additions & 8 deletions features/config-set.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Set the value of a constant or variable defined in wp-config.php file a
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down Expand Up @@ -80,7 +80,7 @@ Feature: Set the value of a constant or variable defined in wp-config.php file a
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down Expand Up @@ -168,11 +168,11 @@ Feature: Set the value of a constant or variable defined in wp-config.php file a
"""

@custom-config-file
Scenario: Updating a non-existent value in wp-custom-config.php without --add
Scenario: Updating a non-existent value in wp-custom-config.php without --add
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down Expand Up @@ -252,7 +252,7 @@ Feature: Set the value of a constant or variable defined in wp-config.php file a
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down Expand Up @@ -314,19 +314,19 @@ Feature: Set the value of a constant or variable defined in wp-config.php file a
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
"""

When I run `wp config set SOME_NAME some_value --type=constant --config-file='wp-custom-config.php'`
When I run `wp config set SOME_NAME some_value --type=constant --config-file='wp-custom-config.php'`
Then STDOUT should be:
"""
Success: Added the constant 'SOME_NAME' to the 'wp-custom-config.php' file with the value 'some_value'.
"""

When I run `wp config set SOME_NAME some_value --type=variable --config-file='wp-custom-config.php'`
When I run `wp config set SOME_NAME some_value --type=variable --config-file='wp-custom-config.php'`
Then STDOUT should be:
"""
Success: Added the variable 'SOME_NAME' to the 'wp-custom-config.php' file with the value 'some_value'.
Expand Down
4 changes: 2 additions & 2 deletions features/config-shuffle-salts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Feature: Refresh the salts in the wp-config.php file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --skip-salts=true --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --skip-salts=true --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down Expand Up @@ -131,7 +131,7 @@ Feature: Refresh the salts in the wp-config.php file
Given an empty directory
And WP files

When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php'`
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php'`
Then STDOUT should contain:
"""
Generated 'wp-custom-config.php' file.
Expand Down