fix(2meet-data-optimizer): compare empty strings correctly when retiring a group
Anti-EAV Lint + Quality Gate / anti-eav-lint (pull_request) Successful in 14s
Tests / Unit Tests (pull_request) Successful in 33s
Tests / PHP Lint (pull_request) Successful in 36s
Tests / Integration Tests (pull_request) Successful in 57s
Tests / PHPCS (pull_request) Successful in 35s
Tests / PHPStan (pull_request) Failing after 50s

- retire() read native meta with wpdb::get_col(), which (via get_var())
  returns null for an empty string, so a flat '' written back as '' was
  counted as a mismatch and blocked the retirement. It now reads raw rows
  with get_results().
- The integration test wpdb stub's get_var() / get_col() now read '' as
  null like the real wpdb, so tests see WordPress behaviour.
- Found writing back the sso group on dev21 / dev22 (picture_url = '').
- Verify: core unit 658 / integration 480 green, phpcs clean
- PR: PR-042 follow-up
This commit is contained in:
2026-09-26 04:24:14 +08:00
parent ecf4ff4938
commit 08492dd795
3 changed files with 16 additions and 4 deletions
@@ -129,6 +129,15 @@ class NativeRestorerRetireTest extends TestCase {
$this->assertSame( 3, $result['mismatches'], 't1, ["1.1.1.1"], t2 are not native yet' );
}
public function test_empty_string_values_count_as_written_back(): void {
global $wpdb;
$wpdb->query( 'UPDATE `' . self::A . "` SET ips = '' WHERE user_id = 2" );
TMDO_Native_Restorer::run( 'user', false, 500, false, 'rt_a' );
self::register( false );
$this->assertSame( 'retired', TMDO_Native_Restorer::retire( 'user', 'rt_a' )['status'], "wpdb::get_col() reads '' as null" );
}
public function test_retire_forgets_the_group_and_keeps_its_table_as_a_backup(): void {
global $wpdb;
TMDO_Native_Restorer::run( 'user', false, 500, false, 'rt_a' );