fix: harden postcodes:import against duplicate headers and test collisions

This commit is contained in:
Ovidiu U
2026-04-22 12:33:10 +01:00
parent 4a60298606
commit 9ad62538b9
2 changed files with 21 additions and 7 deletions

View File

@@ -5,12 +5,14 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
function writeOnspdFixture(string $contents): string
{
$path = tempnam(sys_get_temp_dir(), 'onspd_').'.csv';
file_put_contents($path, $contents);
if (! function_exists('writeOnspdFixture')) {
function writeOnspdFixture(string $contents): string
{
$path = tempnam(sys_get_temp_dir(), 'onspd_').'.csv';
file_put_contents($path, $contents);
return $path;
return $path;
}
}
it('imports active postcodes from an ONSPD CSV', function (): void {