27-05-2026 DHL Modul v2.1 / Optimierung tracking
This commit is contained in:
parent
036595be94
commit
2bdc9ada3c
33 changed files with 2367 additions and 2086 deletions
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Setting;
|
||||
use App\Services\DhlProductResolver;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
beforeEach(function () {
|
||||
config([
|
||||
|
|
@ -57,10 +60,74 @@ it('uses configured international destination countries', function () {
|
|||
}
|
||||
});
|
||||
|
||||
it('uses saved DHL international countries even with env config priority', function () {
|
||||
$createdSettingsTable = ensureDhlSettingsTableForResolverTest();
|
||||
|
||||
try {
|
||||
config([
|
||||
'dhl.config_source' => 'env',
|
||||
'dhl.international_countries' => ['AT'],
|
||||
]);
|
||||
|
||||
Setting::whereSlug('dhl_international_countries')->delete();
|
||||
Setting::setContentBySlug('dhl_international_countries', ['FR'], 'object');
|
||||
|
||||
expect((new DhlProductResolver)->getSupportedInternationalCountries())->toBe(['FR']);
|
||||
} finally {
|
||||
Setting::whereSlug('dhl_international_countries')->delete();
|
||||
|
||||
if ($createdSettingsTable) {
|
||||
Schema::drop('settings');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('keeps an intentionally empty saved DHL international country list', function () {
|
||||
$createdSettingsTable = ensureDhlSettingsTableForResolverTest();
|
||||
|
||||
try {
|
||||
config([
|
||||
'dhl.config_source' => 'env',
|
||||
'dhl.international_countries' => ['AT'],
|
||||
]);
|
||||
|
||||
Setting::whereSlug('dhl_international_countries')->delete();
|
||||
Setting::setContentBySlug('dhl_international_countries', [], 'object');
|
||||
|
||||
expect((new DhlProductResolver)->getSupportedInternationalCountries())->toBe([]);
|
||||
} finally {
|
||||
Setting::whereSlug('dhl_international_countries')->delete();
|
||||
|
||||
if ($createdSettingsTable) {
|
||||
Schema::drop('settings');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('normalizes configurable international countries', function () {
|
||||
expect(DhlProductResolver::normalizeCountryCodeList([' at ', 'DE', 'XX', 'FR', 'AT']))->toBe(['AT', 'FR']);
|
||||
});
|
||||
|
||||
function ensureDhlSettingsTableForResolverTest(): bool
|
||||
{
|
||||
if (Schema::hasTable('settings')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Schema::create('settings', function (Blueprint $table): void {
|
||||
$table->increments('id');
|
||||
$table->string('slug')->index();
|
||||
$table->string('type')->nullable();
|
||||
$table->json('object')->nullable();
|
||||
$table->text('full_text')->nullable();
|
||||
$table->text('text')->nullable();
|
||||
$table->integer('int')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
it('describes DHL product scope for preflight checks', function () {
|
||||
$resolver = new DhlProductResolver;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue