File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 22
33namespace Bavix \Wallet \Test ;
44
5+ use Bavix \Wallet \Exceptions \InsufficientFunds ;
56use Bavix \Wallet \Models \Transaction ;
67use Bavix \Wallet \Test \Models \Buyer ;
78use Bavix \Wallet \Test \Models \ItemTax ;
@@ -102,4 +103,32 @@ public function testGift(): void
102103 $ this ->assertEquals ($ santa ->balance , 0 );
103104 }
104105
106+ /**
107+ * @return void
108+ */
109+ public function testGiftFail (): void
110+ {
111+ $ this ->expectException (InsufficientFunds::class);
112+
113+ /**
114+ * @var Buyer $santa
115+ * @var Buyer $child
116+ * @var ItemTax $product
117+ */
118+ [$ santa , $ child ] = factory (Buyer::class, 2 )->create ();
119+ $ product = factory (ItemTax::class)->create ([
120+ 'quantity ' => 1 ,
121+ ]);
122+
123+ $ this ->assertEquals ($ santa ->balance , 0 );
124+ $ this ->assertEquals ($ child ->balance , 0 );
125+ $ santa ->deposit ($ product ->getAmountProduct ());
126+
127+ $ this ->assertNotEquals ($ santa ->balance , 0 );
128+ $ this ->assertEquals ($ child ->balance , 0 );
129+ $ santa ->wallet ->gift ($ child , $ product );
130+
131+ $ this ->assertEquals ($ santa ->balance , 0 );
132+ }
133+
105134}
You can’t perform that action at this time.
0 commit comments