Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Feb 7, 2024
1 parent e5d16b3 commit eed88ce
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/Units/Domain/BalanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,42 @@ public function testDepositWalletExists(): void
self::assertTrue($buyer->wallet->exists);
}

public function testSetNameAttribute(): void
{
/** @var Buyer $buyer */
$buyer = BuyerFactory::new()->create();
self::assertFalse($buyer->relationLoaded('wallet'));

unset($buyer->wallet["slug"], $buyer->wallet["name"]);

$buyer->wallet->name = "test";
$buyer->wallet->save();

$buyer->deposit(1);

self::assertTrue($buyer->relationLoaded('wallet'));
self::assertTrue($buyer->wallet->exists);

self::assertSame("test", $buyer->wallet->name);
self::assertSame("test", $buyer->wallet->slug);

self::assertTrue($buyer->wallet->forceDelete());
self::assertFalse($buyer->wallet->exists);

$buyer->wallet->name = "test2";
$buyer->wallet->save();

self::assertSame("test2", $buyer->wallet->name);
self::assertSame("test", $buyer->wallet->slug);

// exists
$buyer->wallet->name = "test3";
$buyer->wallet->save();

self::assertSame("test3", $buyer->wallet->name);
self::assertSame("test", $buyer->wallet->slug);
}

public function testDecimalPlaces(): void
{
config([
Expand Down

0 comments on commit eed88ce

Please sign in to comment.