Skip to content

Commit

Permalink
Merge pull request #187 from pwtyler/config-has-184
Browse files Browse the repository at this point in the history
Don't require file to be writable for config has
  • Loading branch information
schlessera authored Sep 17, 2024
2 parents 581bdbb + 1d448c3 commit 4c385fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"require": {
"wp-cli/wp-cli": "^2.5",
"wp-cli/wp-config-transformer": "^1.2.1"
"wp-cli/wp-config-transformer": "^1.4.0"
},
"require-dev": {
"wp-cli/db-command": "^1.3 || ^2",
Expand Down
8 changes: 8 additions & 0 deletions features/config-has.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ 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

Scenario: Check for the existance of an existing wp-config.php constant in a read-only file system
Given a WP install

When I run `chmod -w wp-config.php`
And I try `wp config has DB_NAME`
Then STDOUT should be empty
And the return code should be 0

@custom-config-file
Scenario: Check the existence of an existing wp-custom-config.php constant or variable
Given an empty directory
Expand Down
2 changes: 1 addition & 1 deletion src/Config_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ public function has( $args, $assoc_args ) {
$type = Utils\get_flag_value( $assoc_args, 'type' );

try {
$config_transformer = new WPConfigTransformer( $path );
$config_transformer = new WPConfigTransformer( $path, true );

switch ( $type ) {
case 'all':
Expand Down

0 comments on commit 4c385fd

Please sign in to comment.