File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 1414/** @deprecated */
1515final class WalletServiceLegacy
1616{
17- private MathServiceInterface $ math ;
17+ private MathServiceInterface $ mathService ;
1818 private RegulatorServiceInterface $ regulatorService ;
1919 private AtomicServiceInterface $ atomicService ;
2020
2121 public function __construct (
22- MathServiceInterface $ math ,
22+ MathServiceInterface $ mathService ,
2323 RegulatorServiceInterface $ regulatorService ,
2424 AtomicServiceInterface $ atomicService
2525 ) {
26- $ this ->math = $ math ;
26+ $ this ->mathService = $ mathService ;
2727 $ this ->regulatorService = $ regulatorService ;
2828 $ this ->atomicService = $ atomicService ;
2929 }
@@ -42,7 +42,7 @@ public function refresh(WalletModel $wallet): bool
4242 return $ this ->atomicService ->block ($ wallet , function () use ($ wallet ) {
4343 $ whatIs = $ wallet ->balance ;
4444 $ balance = $ wallet ->getAvailableBalance ();
45- if ($ this ->math ->compare ($ whatIs , $ balance ) === 0 ) {
45+ if ($ this ->mathService ->compare ($ whatIs , $ balance ) === 0 ) {
4646 return true ;
4747 }
4848
Original file line number Diff line number Diff line change 1111use Illuminate \Config \Repository ;
1212use Illuminate \Foundation \Application ;
1313use Illuminate \Foundation \Testing \RefreshDatabase ;
14+ use Illuminate \Support \Facades \DB ;
1415use Orchestra \Testbench \TestCase as OrchestraTestCase ;
1516
1617/**
@@ -20,6 +21,12 @@ class TestCase extends OrchestraTestCase
2021{
2122 use RefreshDatabase;
2223
24+ protected function setUp (): void
25+ {
26+ parent ::setUp ();
27+ DB ::transactionLevel () && DB ::rollBack ();
28+ }
29+
2330 public function expectExceptionMessageStrict (string $ message ): void
2431 {
2532 $ this ->expectExceptionMessageMatches ("~^ {$ message }$~ " );
Original file line number Diff line number Diff line change @@ -95,10 +95,10 @@ public function testSimple(): void
9595 $ result = app (CommonServiceLegacy::class)->addBalance ($ wallet , 100 );
9696 self ::assertTrue ($ result );
9797
98- self ::assertSame ($ wallet ->balanceInt , 1100 );
98+ self ::assertSame (1100 , $ wallet ->balanceInt );
9999 self ::assertTrue ($ wallet ->refreshBalance ());
100100
101- self ::assertSame ($ wallet ->balanceInt , 1000 );
101+ self ::assertSame (1000 , $ wallet ->balanceInt );
102102
103103 $ key = $ wallet ->getKey ();
104104 self ::assertTrue ($ wallet ->delete ());
@@ -195,6 +195,7 @@ public function testForceUpdate(): void
195195
196196 $ wallet ->deposit (1000 );
197197 self ::assertSame (1000 , $ wallet ->balanceInt );
198+ self ::assertSame (0 , (int ) app (RegulatorServiceInterface::class)->diff ($ wallet ));
198199
199200 Wallet::whereKey ($ buyer ->wallet ->getKey ())
200201 ->update (['balance ' => 10 ])
You can’t perform that action at this time.
0 commit comments