Skip to content

Commit

Permalink
fix units
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Apr 26, 2022
1 parent aef1fb9 commit 95f6bbc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Services/TransferService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public function apply(array $objects): array
$deposit = $transactions[$object->getDepositDto()->getUuid()] ?? null;
assert($deposit !== null);

$fromWallet = $this->castService->getModel($object->getFromWallet());
$toWallet = $this->castService->getModel($object->getToWallet());
$fromWallet = $this->castService->getWallet($object->getFromWallet());
$toWallet = $this->castService->getWallet($object->getToWallet());

$transfer = $this->transferDtoAssembler->create(
$deposit->getKey(),
Expand All @@ -90,8 +90,8 @@ public function apply(array $objects): array
$links[$transfer->getUuid()] = [
'deposit' => $deposit,
'withdraw' => $withdraw,
'from' => $fromWallet,
'to' => $toWallet,
'from' => $fromWallet->withoutRelations(),
'to' => $toWallet->withoutRelations(),
];
}

Expand Down
6 changes: 4 additions & 2 deletions tests/Units/Domain/EagerLoadingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ public function testTransferTransactions(): void
self::assertTrue($transfer->relationLoaded('from'));
self::assertTrue($transfer->relationLoaded('to'));

self::assertSame($user1->wallet, $transfer->from);
self::assertSame($user2->wallet, $transfer->to);
self::assertSame($user1->wallet->getMorphClass(), $transfer->from->getMorphClass());
self::assertSame($user1->wallet->getKey(), $transfer->from->getKey());
self::assertSame($user2->wallet->getMorphClass(), $transfer->to->getMorphClass());
self::assertSame($user2->wallet->getKey(), $transfer->to->getKey());
}

public function testMultiWallets(): void
Expand Down

0 comments on commit 95f6bbc

Please sign in to comment.