Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
},
"require-dev": {
"brianium/paratest": "^7.3",
"cknow/laravel-money": "^7.2",
"ergebnis/phpstan-rules": "^2.1",
"infection/infection": "~0.27",
"laravel/cashier": "^15.0",
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 readonly class Money
{
public function __construct(
public string $amount,
public 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