# Accounting & Management Suite QA Checklist This document outlines the test coverage for the Management Suite accounting features. ## Running the Test Suite ### Run All Accounting Tests ```bash # Using PHPUnit php artisan test --filter=Accounting # Using Pest (if configured) ./vendor/bin/pest tests/Feature/Accounting/ # With verbose output php artisan test --filter=Accounting -v ``` ### Run Specific Test Files ```bash # Suite and Permission tests php artisan test tests/Feature/Accounting/SuiteMenusTest.php php artisan test tests/Feature/Accounting/ManagementMutationsTest.php php artisan test tests/Feature/Accounting/BusinessScopingTest.php # Finance flow tests (skipped until models exist) php artisan test tests/Feature/Accounting/ApFlowTest.php php artisan test tests/Feature/Accounting/ArFlowTest.php php artisan test tests/Feature/Accounting/BankAccountsAndTransfersTest.php php artisan test tests/Feature/Accounting/FixedAssetsTest.php php artisan test tests/Feature/Accounting/ExpensesReimbursementTest.php php artisan test tests/Feature/Accounting/RecurringTransactionsTest.php php artisan test tests/Feature/Accounting/BudgetsTest.php # Notification tests php artisan test tests/Feature/Accounting/NotificationsTest.php # Migration safety php artisan test tests/Feature/Accounting/MigrationSafetyTest.php ``` ## Test Coverage Overview ### Currently Active Tests (Pass Now) | Test File | Description | Status | |-----------|-------------|--------| | `SuiteMenusTest.php` | Suite assignment & menu visibility | ✅ Active | | `BusinessScopingTest.php` | Multi-tenant data isolation | ✅ Active | | `NotificationsTest.php` | Finance notification types & service | ✅ Active | | `ManagementMutationsTest.php` | Permission enforcement | ✅ Active | | `MigrationSafetyTest.php` | Database migration integrity | ✅ Active | ### Skeleton Tests (Skipped Until Models Exist) | Test File | Description | Required Models | |-----------|-------------|-----------------| | `ApFlowTest.php` | PO → Bill → Payment flow | `ApBill`, `ApVendor`, `GlAccount`, `JournalEntry` | | `ArFlowTest.php` | Invoice → Payment → Credit limits | `ArCustomer`, `ArInvoice`, `GlAccount`, `JournalEntry` | | `BankAccountsAndTransfersTest.php` | Bank transfers & balances | `BankAccount`, `BankTransfer`, `GlAccount` | | `FixedAssetsTest.php` | Depreciation & disposal | `FixedAsset`, `GlAccount`, `JournalEntry` | | `ExpensesReimbursementTest.php` | Expense approval workflow | `Expense`, `ExpenseItem`, `GlAccount` | | `RecurringTransactionsTest.php` | Auto-generated transactions | `RecurringSchedule` | | `BudgetsTest.php` | Budget vs actual reporting | `Budget`, `GlAccount` | ## Main Flows Tested ### 1. AP Flow (Accounts Payable) - [ ] Bill creation from Purchase Order - [ ] Bill approval workflow - [ ] Payment posting with correct GL entries - [ ] Intercompany entries (Due To/Due From) - [ ] AP aging report accuracy ### 2. AR Flow (Accounts Receivable) - [ ] AR customer with credit limit - [ ] Invoice creation within/over credit limit - [ ] Credit hold application and release - [ ] Payment recording - [ ] AR aging report accuracy ### 3. Bank Accounts & Transfers - [ ] Bank account creation with GL linking - [ ] Internal transfer between accounts - [ ] Journal entry posting for transfers - [ ] Balance calculations ### 4. Fixed Assets - [ ] Asset acquisition with GL entry - [ ] Monthly depreciation calculation - [ ] Accumulated depreciation tracking - [ ] Asset disposal with gain/loss ### 5. Expenses & Reimbursements - [ ] Expense creation with line items - [ ] Approval workflow - [ ] Reimbursement processing - [ ] Journal entry posting ### 6. Recurring Transactions - [ ] Schedule creation for AR/AP - [ ] Automatic transaction generation - [ ] Duplicate prevention - [ ] Schedule management ### 7. Budgets - [ ] Budget creation by department/account - [ ] Budget vs actual calculation - [ ] Variance reporting - [ ] Threshold alerts ## Permission Tests ### Management Suite Only Actions - [ ] Fixed asset create/edit/dispose - [ ] Large expense approval - [ ] Credit limit changes - [ ] Credit hold management - [ ] Budget creation/modification ### Business Scoping - [ ] Users cannot access other business data - [ ] Business slug validation in routes - [ ] Notification isolation by business ## Demo Data Seeder ### Running the Seeder ```bash # Run AccountingDemoSeeder only php artisan db:seed --class=AccountingDemoSeeder # Or via dev:setup php artisan dev:setup --fresh # Select "Yes" when prompted for seeding ``` ### What Gets Created **Businesses:** - Canopy AZ LLC (parent, Management Suite) - Cannabrands (child, Sales Suite) - Curagreen (child, Sales Suite) - Leopard AZ (child, Sales Suite) **Users:** - `cfo@canopy-test.com` (CFO at Canopy) - `finance@canopy-test.com` (Finance Manager at Canopy) - `owner@cannabrands-test.com` (Owner at Cannabrands) - `owner@curagreen-test.com` (Owner at Curagreen) - `owner@leopard-az-test.com` (Owner at Leopard AZ) **Sample Notifications:** - Budget threshold warning - Past due invoice alert - Low cash forecast warning - Low inventory alerts ## Known Limitations 1. **Finance Models Not Yet Implemented** - Most accounting tests are skipped with `->skip()` until models exist - Tests document expected behavior for implementation 2. **Intercompany Accounting** - Due To/Due From logic not yet built - Tests are placeholders for future implementation 3. **Plaid Integration** - Bank feed integration tests not included - Would require sandbox environment setup 4. **Report Generation** - PDF report generation not tested - Would need separate report service tests ## Adding New Tests When implementing new finance features: 1. **Remove the skip condition** from the relevant test 2. **Update test assertions** with actual model/service calls 3. **Add factory definitions** for new models 4. **Update AccountingDemoSeeder** with sample data 5. **Run tests** to verify implementation Example: ```php // Before (skipped): test('bill can be created from purchase order', function () { expect(true)->toBeTrue(); })->skip(fn () => !apModelsExist(), 'AP models not yet implemented'); // After (active): test('bill can be created from purchase order', function () { $vendor = ApVendor::factory()->create(['business_id' => $this->childBusiness->id]); $po = PurchaseOrder::factory()->create([...]); $bill = ApBill::createFromPurchaseOrder($po); expect($bill)->not->toBeNull(); expect($bill->vendor_id)->toBe($vendor->id); expect($bill->total)->toBe($po->total); }); ``` ## CI Integration These tests are designed to run in CI without special setup: - Use SQLite or PostgreSQL test database - No external services required - Skipped tests don't cause failures - Seeds run automatically in test setup ## Questions? For questions about the accounting module implementation, see: - `docs/SUITES_AND_PRICING_MODEL.md` - Suite architecture - `docs/architecture/DATABASE.md` - Database conventions - `docs/supplements/permissions.md` - Permission system