Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-helldar committed Sep 9, 2023
1 parent a21b898 commit a533dcf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
19 changes: 9 additions & 10 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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'));
}
}
4 changes: 2 additions & 2 deletions tests/Unit/Core/Facades/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
});

Expand Down

0 comments on commit a533dcf

Please sign in to comment.