AtomicServiceInterface doesn't rollback on exception? #976
JavierFerrerGomez
started this conversation in
General
Replies: 1 comment
-
Hello. I checked it. Everything works as expected. Here is the PR: https://github.com/bavix/laravel-wallet/pull/977/files I am 99.99% sure that a transaction is created before your test and atomic does not create a new one. I suggest you add a check that the transaction level is zero. Example: #[Test]
public function transaction_deposit_should_rollback(): void
{
+ self::assertSame(0, \Illuminate\Support\Facades\DB::transactionLevel()); I think the test will start to fail on this line. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I didn't open this as an issue because I am not sure I understood how AtomicServiceInterface should work. If this is indeed a bug I will open an issue with a proper working test case.
When using AtomicServiceInterface I am expecting that in the case of an exception all operations already applied to the DB will be rollbacked, but that is not the case. This is the relevant code in my user model:
Then in my test case I have:
When I runt the test, in my catch statement the current balance is 10010 (getConfirmedGlobalBalanceInt calls refreshBalance internally) and the email address is [email protected]. What am I missing?
Beta Was this translation helpful? Give feedback.
All reactions