whisper-money/tests/Feature
Víctor Falcón ca084ce5d1
feat(commands): delete transactions and balances of a user's non-connected accounts (#728)
## What

Adds an artisan command that deletes all transactions and balances of a
specific user's **non-connected** (manual) accounts, identified by
email.

```bash
php artisan user:delete-manual-account-data user@example.com
```

## Behavior

- Looks up the user by email (`withTrashed`, matching `user:delete`).
- Selects accounts with `banking_connection_id IS NULL` (manual
accounts).
- Shows a confirmation prompt with the transaction/balance counts and
the number of affected accounts.
- On confirm, deletes inside a `DB::transaction`:
- Transactions via `forceDelete()` (they use `SoftDeletes`, so this also
purges already soft-deleted rows).
- Balances via `delete()` (`AccountBalance` has no `SoftDeletes`, so
it's a hard delete).
- The accounts themselves are **not** deleted — only their transactions
and balances.

Related `label_transaction`, `budget_transactions` and
`category_corrections` rows are cleaned up by existing
`cascadeOnDelete()` foreign keys.

## Tests

Pest feature test covering: manual-only deletion (connected accounts
untouched), cross-user isolation, soft-deleted transactions counted and
purged, connected-only user reports zero, cancellation, and
user-not-found.

QA skipped per request (backend maintenance command, covered by feature
tests).
2026-07-23 08:26:11 +00:00
..
Ai
…
Api
…
Auth fix(auth): make build deterministic when REGISTRATION_ENABLED=false (#720) 2026-07-22 07:04:20 +00:00
Console feat(commands): delete transactions and balances of a user's non-connected accounts (#728) 2026-07-23 08:26:11 +00:00
Events
…
Jobs
…
Listeners
…
Mcp feat(mcp): filter search_transactions by label (#724) 2026-07-22 15:13:03 +02:00
Onboarding
…
OpenBanking
…
Services
…
Settings
…
Spaces
…
Sync
…
AccountBalanceControllerTest.php
…
AccountControllerTest.php
…
AccountImportConfigTest.php
…
AccountUserCurrencyServiceTest.php
…
AiConsentSettingsTest.php
…
AiConsentTest.php
…
AlignAccountsEncryptedFlagMigrationTest.php
…
ApplyRealEstateRevaluationTest.php
…
AuthenticatedLayoutSafeAreaTest.php
…
AutomationRuleApplicationTest.php
…
AutomationRuleEvaluationTest.php
…
AutomationRuleTest.php
…
BackfillAccountIbansCommandTest.php
…
BackfillXxxAccountCurrenciesTest.php
…
BalanceLookupTest.php
…
BudgetHistoricalAssignmentTest.php
…
BudgetPeriodDateTest.php
…
BudgetPeriodServiceTest.php
…
BudgetTest.php
…
BudgetTransactionServiceTest.php
…
BulkUpdateTransactionsTest.php
…
CancelFreeEnableBankingConnectionsCommandTest.php
…
CashflowAnalyticsTest.php
…
CashflowPageTest.php
…
CatchAllBudgetTest.php
…
CategoryMonthlyBreakdownTest.php
…
CurrencyConversionServiceTest.php
…
DashboardAnalyticsTest.php
…
DashboardTest.php fix(auth): make build deterministic when REGISTRATION_ENABLED=false (#720) 2026-07-22 07:04:20 +00:00
DecryptTransactionsTest.php
…
DeleteUserCommandTest.php
…
DemoAccountRestrictionsTest.php
…
DisconnectBankingConnectionsCommandTest.php
…
DiscordWebhookTest.php
…
EncryptionTest.php
…
ExampleTest.php
…
ExchangeRateServiceTest.php
…
GenerateStripePromotionCodesCommandTest.php
…
IdorVulnerabilityTest.php
…
ImportDataTest.php
…
InertiaSharedDataTest.php
…
IntegrationRequestTest.php
…
LabelTest.php
…
LoanTest.php
…
LocalizationTest.php
…
LoggingConfigTest.php
…
MailSenderTest.php
…
NewTransactionsMarkerTest.php
…
PersistUpsellSourceFromStripeTest.php
…
PlaintextTransactionsTest.php
…
PlanFeatureTest.php
…
PopoverSafeAreaTest.php
…
PostStripeEventToDiscordTest.php
…
PurgeResidualEncryptionArtifactsJobTest.php
…
PwaTest.php
…
QueueConfigTest.php
…
ReEvaluateTransactionRulesTest.php
…
RealEstateAvailabilityTest.php
…
RealEstateTest.php
…
ResendSyncCommandTest.php
…
RouteNotificationForMailTest.php
…
RuleEngineParityTest.php
…
SavedFilterTest.php
…
SelfServeRefundTest.php
…
SendAiCohortReportCommandTest.php
…
SendAiConsentFollowUpEmailsCommandTest.php
…
SendDailyStatsReportCommandTest.php
…
SendExperimentFunnelReportCommandTest.php
…
SendStuckCohortReportCommandTest.php
…
SendSubscriptionFunnelReportCommandTest.php
…
SentryConfigTest.php
…
SentryUserMiddlewareTest.php
…
SetLocaleTest.php
…
SitemapTest.php
…
StrayHttpRequestGuardTest.php
…
StripeSubscriptionStatsCommandTest.php
…
SubscriptionExperimentTest.php
…
SubscriptionTest.php
…
SuggestionPersistenceTest.php
…
SyncBankingConnectionsCommandTest.php
…
SyncStripePricesCommandTest.php
…
TrackLastActiveAtTest.php
…
TransactionAnalysisTest.php
…
TransactionFilterTest.php
…
TransactionSideClassificationTest.php
…
TransactionTest.php
…
WelcomeBanksOrderingTest.php
…