24 lines
577 B
PHP
24 lines
577 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Integration\WithApp\Infra\Adapters\Services;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Infrastructure\Adapters\Services\LaravelTransactionManager;
|
|
|
|
it('executes callback in transaction', function () {
|
|
// GIVEN
|
|
DB::shouldReceive('transaction')->once()->andReturnUsing(function ($callback) {
|
|
return $callback();
|
|
});
|
|
$manager = new LaravelTransactionManager();
|
|
|
|
// WHEN
|
|
$result = $manager->execute(function () {
|
|
return 'success';
|
|
});
|
|
|
|
// THEN
|
|
expect($result)->toBe('success');
|
|
});
|