diff --git a/tests/TestCase.php b/tests/TestCase.php index 56f9a42b..d1d6515d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -91,7 +91,7 @@ protected function setUpStatuses(Application $app): void protected function setUpDrivers(Application $app): void { - $this->setUpDriver($app, TypeEnum::cash, CashDriver::class, Cash::class); + $this->setUpDriver($app, TypeEnum::cash, CashDriver::class, Cash::class, null); $this->setUpDriver($app, TypeEnum::tinkoffOnline, TinkoffOnlineDriver::class, TinkoffOnline::class); $this->setUpDriver($app, TypeEnum::tinkoffQrCode, TinkoffQrCodeDriver::class, TinkoffQrCode::class); @@ -112,17 +112,16 @@ protected function setUpDriver( TypeEnum $type, string $driver, string $resource, - array $credentials = [] + ?array $credentials = [] ): void { - $app['config']->set('cashbox.payment.drivers.' . $type->value, $type); - - $app['config']->set('cashbox.drivers.' . $type->value, [ - 'driver' => $driver, - 'resource' => $resource, - 'credentials' => array_merge([ + if (! is_null($credentials)) { + $credentials = array_merge([ 'client_id' => 'qwerty', 'client_secret' => 'qwerty123', - ], $credentials), - ]); + ], $credentials); + } + + $app['config']->set('cashbox.payment.drivers.' . $type->value, $type); + $app['config']->set('cashbox.drivers.' . $type->value, compact('driver', 'resource', 'credentials')); } } diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 5e628a74..5eaaa126 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -60,12 +60,12 @@ expect($data->status->failed)->toBe(StatusEnum::failed); expect($data->drivers)->toBeArray(); - expect($data->drivers)->toBe([ + expect($data->drivers)->toMatchArray([ TypeEnum::cash() => TypeEnum::cash, + TypeEnum::sberQrCode() => TypeEnum::sberQrCode, TypeEnum::tinkoffCredit() => TypeEnum::tinkoffCredit, TypeEnum::tinkoffOnline() => TypeEnum::tinkoffOnline, TypeEnum::tinkoffQrCode() => TypeEnum::tinkoffQrCode, - TypeEnum::sberQrCode() => TypeEnum::sberQrCode, ]); });