Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Feb 11, 2024
1 parent cdd2b6d commit 37acbee
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"wallet",
"payments"
],
"minimum-stability": "stable",
"minimum-stability": "dev",
"prefer-stable": true,
"homepage": "https://bavix.github.io/laravel-wallet/",
"license": "MIT",
"authors": [
Expand All @@ -26,14 +27,12 @@
"ext-json": "*",
"ext-pdo": "*",
"brick/math": "~0.10",
"doctrine/dbal": "^3.5",
"illuminate/contracts": "^10.0",
"illuminate/database": "^10.0",
"illuminate/contracts": "^10.0|^11.0",
"illuminate/database": "^10.0|^11.0",
"ramsey/uuid": "^4.0"
},
"require-dev": {
"brianium/paratest": "^7.2",
"cknow/laravel-money": "^7.1",
"ergebnis/phpstan-rules": "^1.0",
"infection/infection": "~0.27",
"laravel/cashier": "^15.0",
Expand All @@ -47,7 +46,9 @@
},
"suggest": {
"bavix/laravel-wallet-swap": "Addition to the laravel-wallet library for quick setting of exchange rates",
"bavix/laravel-wallet-warmup": "Addition to the laravel-wallet library for refresh balance wallets"
"bavix/laravel-wallet-uuid": "Addition to the laravel-wallet library uuid support in laravel-wallet",
"bavix/laravel-wallet-warmup": "Addition to the laravel-wallet library for refresh balance wallets",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^3.5.1)."
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions tests/Infra/PackageModels/TransactionMoney.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Bavix\Wallet\Test\Infra\PackageModels;

use Cknow\Money\Money;
use Bavix\Wallet\Test\Infra\Values\Money;

/**
* Class Transaction.
Expand All @@ -17,7 +17,7 @@ final class TransactionMoney extends \Bavix\Wallet\Models\Transaction

public function getCurrencyAttribute(): Money
{
$this->currency ??= \money($this->amount, $this->meta['currency'] ?? 'USD');
$this->currency ??= new Money($this->amount, $this->meta['currency'] ?? 'USD');

return $this->currency;
}
Expand Down
14 changes: 14 additions & 0 deletions tests/Infra/Values/Money.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace Bavix\Wallet\Test\Infra\Values;

final class Money
{
public function __construct(
public readonly string $amount,
public readonly string $currency,
) {
}
}
4 changes: 2 additions & 2 deletions tests/Units/Domain/WalletExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public function testTransactionMoneyAttribute(): void
self::assertTrue($transaction->getKey() > 0);
self::assertSame($transaction->amountInt, $buyer->balanceInt);
self::assertInstanceOf(TransactionMoney::class, $transaction);
self::assertSame('1000', $transaction->currency->getAmount());
self::assertSame('EUR', $transaction->currency->getCurrency()->getCode());
self::assertSame('1000', $transaction->currency->amount);
self::assertSame('EUR', $transaction->currency->currency);
}

public function testNoCustomAttribute(): void
Expand Down

0 comments on commit 37acbee

Please sign in to comment.