41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?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();
|
|
});
|