Put email last in contact exports
All checks were successful
Test and publish WordPress plugin / release (push) Successful in 18s

This commit is contained in:
josh
2026-11-02 12:00:46 -05:00
parent 0fe8914981
commit c690c0f8cf
4 changed files with 24 additions and 16 deletions

View File

@@ -125,16 +125,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','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($header===['Submission Date','First Name','Middle Name','Last Name','Referral Source','Referrer Name','Mobile','Email'],'requested eight-column inquiry export with Email last');
check(count($row)===8 && $row[2]==='Anaïs' && $row[5]==='María' && $row[6]==='2025550100' && $row[7]==='synthetic@example.invalid','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($header===['Submission Date','First Name','Middle Name','Last Name','Referral Source','Referrer Name','Prefix','Full Name','Mobile','Home Phone','Work Phone','Address','City','County / State','Country','Postal Code / Zip','Type','Twitter','Linkedin','Facebook','Private Note','Message','Inquiry Street Address','Email'] && count($row)===24 && !in_array('Source Link',$header,true),'lead export has Email last and omits Source Link');
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');
check($lead['Referral Source']==='Friend' && $lead['Referrer Name']==='María' && $lead['Email']==='synthetic@example.invalid' && $lead['Mobile']==='2025550100' && end($row)==='synthetic@example.invalid','lead referral and contact values stay aligned with Email last');
echo "PASS: $checks updater and CSV checks\n";
} finally { foreach($paths as $p) if(file_exists($p)) unlink($p); }