Test imports and exports without running the jobs

Test imports and exports without running the jobs

  • testing
  • import
  • export

New testing helpers to assert importer and exporter behavior in PHPUnit/Pest without digging through queues and temp files yourself.

  • ProductImporter::test()->import([...])->assertImported() checks real casting, validation, column mapping, hook, and saving records and relationships without CSV upload or queues.
  • ImportAction::fake() / ExportAction::fake() assert dispatch (column map, options, query) without processing rows.
  • Exporters get ProductExporter::test(...)->export($record) for row value checks.

Import example:

ProductImporter::test()->import([
    'sku' => 'MUG-001',
    'name' => 'Ceramic mug',
    'price' => '12.50',
])->assertImported();

Export example:

$exports = ExportAction::fake();
// ... callAction ...
$exports->assertDispatched(ProductExporter::class);

$product = Product::factory()->make([
    'name' => 'Oak desk', 'sku' => 'DESK-01',
]);

$row = ProductExporter::test(columnMap: [
    'name' => 'Name', ‘sku' => 'SKU',
])->export($product);

expect($row)->toBe(['Oak desk', 'DESK-01']);
All Filament Up To Date tips