parse($csv)); expect($rows)->toHaveCount(2); expect($rows[0])->toBe(['project' => 'B1_a.com', 'tag' => 'tagA', 'phone' => '79991234567']); expect($rows[1])->toBe(['project' => 'B2_79990001122', 'tag' => 'tagB', 'phone' => '79993334455']); }); it('strips UTF-8 BOM and normalizes CRLF', function (): void { $csv = "\xEF\xBB\xBFName;Tag;Phone\r\nB1_a.com;t;79991234567\r\n"; $rows = rowsOf((new SupplierCsvParser)->parse($csv)); expect($rows)->toHaveCount(1); expect($rows[0]['project'])->toBe('B1_a.com'); }); it('skips malformed rows with fewer than 3 columns', function (): void { $csv = "Name;Tag;Phone\nB1_a.com;t;79991234567\nbroken;row\nB2_b.com;t2;79990000000\n"; $rows = rowsOf((new SupplierCsvParser)->parse($csv)); expect($rows)->toHaveCount(2); expect($rows[1]['project'])->toBe('B2_b.com'); }); it('returns nothing for empty CSV', function (): void { expect(rowsOf((new SupplierCsvParser)->parse('')))->toBe([]); }); it('returns nothing for header-only CSV', function (): void { expect(rowsOf((new SupplierCsvParser)->parse("Name;Tag;Phone\n")))->toBe([]); });