Remove Source Link from Leads and Inquiries CSV exports
All checks were successful
Test and publish WordPress plugin / release (push) Successful in 30s

This commit is contained in:
josh
2026-10-28 13:36:18 -04:00
parent 770a08d5e9
commit 703e5a8692
4 changed files with 26 additions and 17 deletions

View File

@@ -99,7 +99,7 @@ try {
public function get_results($query,$format) { return [[
'time'=>'2026-10-28 15:30:00','first_name'=>'Élodie','middle_name'=>'Anaïs','last_name'=>'de la Cruz',
'source'=>'Friend','source_link'=>'https://staging.jenhome.net/contact/','email'=>'synthetic@example.invalid','mobile'=>'2025550100',
'enquiry_id'=>10,'jenhome_enquiry_id'=>10,'jenhome_referrer_form'=>'6o0tsaob0','enquiry_meta'=>serialize(['streat_address'=>'María']),
'lead_id'=>11,'enquiry_id'=>10,'jenhome_enquiry_id'=>10,'jenhome_referrer_form'=>'6o0tsaob0','enquiry_meta'=>serialize(['streat_address'=>'María']),
'display_name'=>'DO NOT EXPORT','enquiry_type'=>'DO NOT EXPORT','message'=>'DO NOT EXPORT','private_note'=>'DO NOT EXPORT',
]]; }
};
@@ -107,9 +107,16 @@ try {
ob_start(); try { Jenhome_Contact_Exports::export_inquiries(); } catch(Test_Die $e) {} $csv=ob_get_clean();
$rows=explode("\r\n",substr($csv,3));
$header=str_getcsv($rows[0],',','"',''); $row=str_getcsv($rows[1],',','"','');
check($header===['Submission Date','First Name','Middle Name','Last Name','Referral Source','Referrer Name','Source Link','Email','Mobile'],'requested nine-column inquiry export');
check(count($row)===9 && $row[2]==='Anaïs' && $row[5]==='María' && $row[8]==='2025550100','export values align with headings');
check(!str_contains($csv,'DO NOT EXPORT'),'removed fields absent from CSV');
check($header===['Submission Date','First Name','Middle Name','Last Name','Referral Source','Referrer Name','Email','Mobile'],'requested eight-column inquiry export');
check(count($row)===8 && $row[2]==='Anaïs' && $row[5]==='María' && $row[6]==='synthetic@example.invalid' && $row[7]==='2025550100','export values align with headings');
check(!str_contains($csv,'DO NOT EXPORT') && !str_contains($csv,'https://staging.jenhome.net/contact/'),'removed fields and source URL absent from inquiry CSV');
check($row[0]==='2026-10-28 11:30:00 -04:00','submission date remains first and localized');
ob_start(); try { Jenhome_Contact_Exports::export_leads(); } catch(Test_Die $e) {} $csv=ob_get_clean();
$rows=explode("\r\n",substr($csv,3));
$header=str_getcsv($rows[0],',','"',''); $row=str_getcsv($rows[1],',','"','');
check(count($header)===24 && count($row)===24 && !in_array('Source Link',$header,true),'lead export omits Source Link heading and value');
check(!str_contains($csv,'https://staging.jenhome.net/contact/'),'source URL absent from lead CSV');
$lead=array_combine($header,$row);
check($lead['Referral Source']==='Friend' && $lead['Referrer Name']==='María' && $lead['Email']==='synthetic@example.invalid' && $lead['Mobile']==='2025550100','lead referral and contact values stay aligned');
echo "PASS: $checks updater and CSV checks\n";
} finally { foreach($paths as $p) if(file_exists($p)) unlink($p); }