26 lines
1001 B
PHP
26 lines
1001 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Services\Supplier\SupplierExportMode;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\Concerns\SharesSupplierPdo;
|
|
|
|
uses(DatabaseTransactions::class, SharesSupplierPdo::class);
|
|
|
|
it('reads mode from system_settings, defaults batch', function (): void {
|
|
DB::table('system_settings')->where('key', 'supplier_export_mode')->update(['value' => 'online']);
|
|
expect(SupplierExportMode::current())->toBe('online')
|
|
->and(SupplierExportMode::isOnline())->toBeTrue();
|
|
|
|
DB::table('system_settings')->where('key', 'supplier_export_mode')->update(['value' => 'batch']);
|
|
expect(SupplierExportMode::current())->toBe('batch')
|
|
->and(SupplierExportMode::isOnline())->toBeFalse();
|
|
});
|
|
|
|
it('falls back to batch when setting missing', function (): void {
|
|
DB::table('system_settings')->where('key', 'supplier_export_mode')->delete();
|
|
expect(SupplierExportMode::current())->toBe('batch');
|
|
});
|