CSV export: only completed donations (not abandoned checkouts)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c7f2dcffeb
commit
875ca42054
2 files changed
+17
-1
No files matched your search
@@ -52,4 +52,20 @@ final class AdminStoreRulesTest extends TestCase {
|
||||
$this->assertIsArray( $r['config'] );
|
||||
$this->assertNull( Store::rule( 99, 1 ) );
|
||||
}
|
||||
|
||||
public function test_export_only_selects_completed_non_test_donations(): void {
|
||||
$captured = array();
|
||||
$GLOBALS['wpdb'] = new class( $captured ) {
|
||||
public string $prefix = 'wp_';
|
||||
public function __construct( public array &$sql ) {}
|
||||
public function esc_like( string $s ): string { return $s; }
|
||||
public function prepare( string $q, ...$args ): string { return $q; }
|
||||
public function get_results( string $q, $output = null ): array { $this->sql[] = $q; return array(); }
|
||||
};
|
||||
Store::exportBatch( 0, 100 );
|
||||
$this->assertNotEmpty( $captured );
|
||||
$this->assertStringContainsString( "status = 'completed'", $captured[0], 'abandoned/unpaid checkouts must not be exported' );
|
||||
$this->assertStringContainsString( 'goal_id > 0', $captured[0], 'test donations must not be exported' );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user