2026-06-22 20:26:47 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
use App\Models\PaymentGateway;
|
|
|
|
|
use Illuminate\Support\Facades\Crypt;
|
2026-07-01 15:45:37 +03:00
|
|
|
use Tests\TestCase;
|
2026-06-22 20:26:47 +03:00
|
|
|
|
2026-07-01 15:45:37 +03:00
|
|
|
uses(TestCase::class);
|
2026-06-22 20:26:47 +03:00
|
|
|
|
|
|
|
|
it('расшифровывает config в массив через accessor', function () {
|
|
|
|
|
$gw = new PaymentGateway;
|
|
|
|
|
$gw->config = Crypt::encrypt(['shop_id' => '123', 'secret_key' => 'test_secret']);
|
|
|
|
|
|
|
|
|
|
expect($gw->credentials())->toBe(['shop_id' => '123', 'secret_key' => 'test_secret']);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('возвращает пустой массив если config пустой', function () {
|
|
|
|
|
$gw = new PaymentGateway;
|
|
|
|
|
$gw->config = '';
|
|
|
|
|
|
|
|
|
|
expect($gw->credentials())->toBe([]);
|
|
|
|
|
});
|