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
41
tests/Unit/Dhl/CreateShipmentJobSerializationTest.php
Normal file
41
tests/Unit/Dhl/CreateShipmentJobSerializationTest.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
use App\Jobs\CreateShipmentJob;
|
||||
use App\Models\ShoppingOrder;
|
||||
|
||||
it('never serializes DHL credentials into the queue payload', function () {
|
||||
$order = new ShoppingOrder;
|
||||
$order->id = 4711;
|
||||
|
||||
$dhlConfig = [
|
||||
'base_url' => 'https://api-eu.dhl.com',
|
||||
'api_key' => 'super-secret-api-key',
|
||||
'username' => 'mivita-user',
|
||||
'password' => 'super-secret-password',
|
||||
'api_secret' => 'super-secret-api-secret',
|
||||
'billing_number' => '63144073550101',
|
||||
];
|
||||
|
||||
$job = new CreateShipmentJob($order, 2.5, ['priority' => 'normal'], $dhlConfig);
|
||||
|
||||
$serialized = serialize($job);
|
||||
|
||||
expect($serialized)
|
||||
->not->toContain('super-secret-api-key')
|
||||
->not->toContain('super-secret-password')
|
||||
->not->toContain('super-secret-api-secret')
|
||||
->not->toContain('mivita-user')
|
||||
->not->toContain('63144073550101');
|
||||
});
|
||||
|
||||
it('does not expose a dhlConfig property on the job instance', function () {
|
||||
$order = new ShoppingOrder;
|
||||
$order->id = 1;
|
||||
|
||||
$job = new CreateShipmentJob($order, 1.0, [], [
|
||||
'api_key' => 'should-not-be-stored',
|
||||
'password' => 'should-not-be-stored',
|
||||
]);
|
||||
|
||||
expect(property_exists($job, 'dhlConfig'))->toBeFalse();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue