TenantAtlas/tests/Unit/BulkOperationAbortMethodTest.php
Ahmed Darrazi de199ef476 fix(tests): remove per-file TestCase uses
Pest v4 discovery fails when unit tests re-bind the test case with uses(TestCase::class). Remove per-file bindings and keep RefreshDatabase where needed. Also update RunBackupScheduleJobTest to pass BulkOperationService when calling handle() manually.
2026-01-08 01:38:54 +01:00

24 lines
628 B
PHP

<?php
use App\Models\BulkOperationRun;
use App\Models\Tenant;
use App\Models\User;
use App\Services\BulkOperationService;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
it('can abort a bulk operation run', function () {
$tenant = Tenant::factory()->create();
$user = User::factory()->create();
$run = BulkOperationRun::factory()->create([
'tenant_id' => $tenant->id,
'user_id' => $user->id,
'status' => 'running',
]);
app(BulkOperationService::class)->abort($run, 'threshold exceeded');
expect($run->refresh()->status)->toBe('aborted');
});