Skip to content

Commit 04486ef

Browse files
authored
Merge pull request #839 from bavix/11.x-remove-depends-cknow
[11.x] remove cknow/laravel-money
2 parents a04c760 + d2fe9bd commit 04486ef

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
},
3434
"require-dev": {
3535
"brianium/paratest": "^7.3",
36-
"cknow/laravel-money": "^7.2",
3736
"ergebnis/phpstan-rules": "^2.1",
3837
"infection/infection": "~0.27",
3938
"laravel/cashier": "^15.0",

tests/Infra/PackageModels/TransactionMoney.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Bavix\Wallet\Test\Infra\PackageModels;
66

7-
use Cknow\Money\Money;
7+
use Bavix\Wallet\Test\Infra\Values\Money;
88

99
/**
1010
* Class Transaction.
@@ -17,7 +17,7 @@ final class TransactionMoney extends \Bavix\Wallet\Models\Transaction
1717

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

2222
return $this->currency;
2323
}

tests/Infra/Values/Money.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bavix\Wallet\Test\Infra\Values;
6+
7+
final readonly class Money
8+
{
9+
public function __construct(
10+
public string $amount,
11+
public string $currency,
12+
) {
13+
}
14+
}

tests/Units/Domain/WalletExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public function testTransactionMoneyAttribute(): void
5353
self::assertTrue($transaction->getKey() > 0);
5454
self::assertSame($transaction->amountInt, $buyer->balanceInt);
5555
self::assertInstanceOf(TransactionMoney::class, $transaction);
56-
self::assertSame('1000', $transaction->currency->getAmount());
57-
self::assertSame('EUR', $transaction->currency->getCurrency()->getCode());
56+
self::assertSame('1000', $transaction->currency->amount);
57+
self::assertSame('EUR', $transaction->currency->currency);
5858
}
5959

6060
public function testNoCustomAttribute(): void

0 commit comments

Comments
 (0)