Skip to content

Commit c815ae4

Browse files
committed
Add test for the simultaneous presence of --force-check and --skip-update-check.
Signed-off-by: Saul Baizman <[email protected]>
1 parent a0ad195 commit c815ae4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/WP_CLI/CommandWithUpgrade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,11 @@ static function ( $result ) {
532532
// phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore -- Whitelisting to provide backward compatibility to classes possibly extending this class.
533533
protected function _list( $_, $assoc_args ) {
534534

535+
// If `--force-check` and `--skip-update-check` flags are both present, abort.
536+
if ( true === (bool) Utils\get_flag_value( $assoc_args, 'force-check', false ) and true === (bool) Utils\get_flag_value( $assoc_args, 'skip-update-check', false ) ) {
537+
WP_CLI::error("{$this->item_type} updates cannot be both force-checked and skipped. Choose one.");
538+
}
539+
535540
// If `--force-check` flag is present, delete the upgrade transient.
536541
if ( true === (bool) Utils\get_flag_value( $assoc_args, 'force-check', false ) ) {
537542
delete_site_transient( $this->upgrade_transient );

0 commit comments

Comments
 (0)