Skip to content

Failing tests #588

Closed
Closed
@martin-ro

Description

@martin-ro

Describe your task
When running my tests I get Working inside an embedded transaction is not possible.

To Reproduce
Steps to reproduce the behavior:
Create a test:

<?php

use App\Models\User;
use function Pest\Laravel\actingAs;
use function Pest\Laravel\get;

uses()->group('WalletTest');

test('fails', function () {
    $user = User::factory()->asStudent()->create();

    actingAs($user)
        ->get('/')
        ->assertOk();
});

test('works', function () {
    $user = User::factory()->asStudent()->create();

    get('/')->assertOk();
});

Trace Error

 Working inside an embedded transaction is not possible. https://bavix.github.io/laravel-wallet/#/transaction

  at tests/Feature/WallteTest.php:14
     10▕     $user = User::factory()->asStudent()->create();
     11▕ 
     12▕     actingAs($user)
     13▕         ->get('/')
  ➜  14▕         ->assertOk();
     15▕ });
     16▕ 
     17▕ test('works', function () {
     18▕     $user = User::factory()->asStudent()->create();



  Tests:  1 failed, 1 passed
  Time:   4.52s

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Server:

  • php version: 8.1
  • database: mysql 8.0
  • wallet version 9.5.0
  • cache lock: redis
  • cache wallets: redis

Additional context
I've read #463 but this behavior still doesn't really make any sense to me. What DB transaction is not closed using actingAs?

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions