Skip to content

Commit b3f2da1

Browse files
Copilotswissspidy
andcommitted
Remove WP_CLI::log calls that break existing tests
Remove extra log messages before the progress bar ('Updating table.column (X rows)' and 'Exporting table (X rows)'). The progress bar label already includes the table and column names. Update Behat tests to check STDERR for 'Processing' (progress bar output) instead of STDOUT for 'Updating'. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent b6b7e3b commit b3f2da1

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

features/search-replace.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,9 +1422,9 @@ Feature: Do global search/replace
14221422
And I run `wp option set test_url 'Visit http://example.com for more'`
14231423

14241424
When I run `wp search-replace http://example.com http://example.org --precise`
1425-
Then STDOUT should contain:
1425+
Then STDERR should contain:
14261426
"""
1427-
Updating
1427+
Processing
14281428
"""
14291429

14301430
@require-mysql
@@ -1437,9 +1437,9 @@ Feature: Do global search/replace
14371437
"""
14381438
Checking:
14391439
"""
1440-
And STDOUT should not contain:
1440+
And STDERR should not contain:
14411441
"""
1442-
Updating
1442+
Processing
14431443
"""
14441444

14451445
@require-mysql

src/Search_Replace_Command.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,6 @@ private function php_export_table( $table, $old, $new ) {
616616
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
617617
$total_rows = $wpdb->get_var( "SELECT COUNT(*) FROM {$table_sql}" );
618618
if ( $total_rows > 0 ) {
619-
WP_CLI::log( sprintf( 'Exporting %s (%d rows)', $table, $total_rows ) );
620619
$progress = \WP_CLI\Utils\make_progress_bar( sprintf( 'Processing %s', $table ), $total_rows );
621620
}
622621
}
@@ -734,7 +733,6 @@ static function ( $key ) {
734733
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
735734
$total_rows = $wpdb->get_var( "SELECT COUNT(*) FROM {$table_sql} {$where_key}" );
736735
if ( $total_rows > 0 ) {
737-
WP_CLI::log( sprintf( 'Updating %s.%s (%d rows)', $table, $col, $total_rows ) );
738736
$progress = \WP_CLI\Utils\make_progress_bar( sprintf( 'Processing %s.%s', $table, $col ), $total_rows );
739737
}
740738
}

0 commit comments

Comments
 (0)