create(); $contract = Contract::factory()->create([ 'client_case_id' => $case->id, 'active' => 1, ]); $accountTypeId = \DB::table('account_types')->insertGetId([ 'name' => 'Type', 'description' => null, 'created_at' => now(), 'updated_at' => now(), 'deleted_at' => null, ]); $account = Account::create([ 'contract_id' => $contract->id, 'type_id' => $accountTypeId, 'active' => 1, 'initial_amount' => 0, 'balance_amount' => 0, ]); ArchiveSetting::factory()->create([ 'enabled' => true, 'strategy' => 'manual', 'soft' => true, 'entities' => [ ['table' => 'contracts', 'focus' => true], ['table' => 'contracts.account'], ], ]); $user = User::factory()->create(); $this->actingAs($user); $this->post(route('clientCase.contract.archive', ['client_case' => $case->uuid, 'uuid' => $contract->uuid])) ->assertRedirect(); $this->assertDatabaseHas('accounts', ['id' => $account->id, 'active' => 0]); } }