Skip to content

Commit

Permalink
Merge pull request #839 from bavix/11.x-remove-depends-cknow
Browse files Browse the repository at this point in the history
[11.x] remove cknow/laravel-money
  • Loading branch information
rez1dent3 authored Jan 5, 2024
2 parents a04c760 + d2fe9bd commit 04486ef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
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

0 comments on commit 04486ef

Please sign in to comment.