Commit Graph
3 Commits
Author SHA1 Message Date
objecttothis 2a42079262 test: align export/report tests with shared fixtures and date filters
- CashupControllerTest: add start_date/end_date params to export-all
  CSV/PDF requests and update expected totals/body assertions to
  match seeded cashup data (closed_amount_total 169.42).
- ExpensesControllerTest: replace manual seeder bootstrap with shared
  DatabaseBootstrapTrait::resetDatabaseOnce, and grant
  expenses_categories permission to test employee for category access.
- ReportsControllerTest: invoke buildDownloadHeaders on response
  before asserting Content-Disposition, matching actual download flow.
- export_helperTest / tabular_helperTest: replace manual OSPOS config
  mock construction (Factories::injectMock) with shared
  OsposConfigFixtureTrait::injectOsposSettings, reducing duplication
  and adding missing number_locale/currency_symbol settings.

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
2026-10-23 11:21:25 +04:00
objecttothis 41618feef4 fix(tests): improve DownloadResponse handling in export tests
- Add `downloadResponseBody()` helper to all controller export tests for asserting streamed download content (CSV/PDF).
- Update export test endpoints to explicitly include query parameters, e.g., `?search=` for consistency.
- Resolve private `$binary` access via reflection to verify download contents in exports.
- Fix issues with headers (`Content-Disposition` and `Content-Type`) and body assertions.

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
2026-10-21 16:45:28 +04:00
objecttothis 4bc2bac204 test: add export-all coverage across controllers and helpers
Add feature tests verifying CSV/PDF/XML/SQL export endpoints work
correctly across many controllers, plus helper unit tests and shared
fixtures to support them.

- Add downloadResponseBody() reflection helper (reads private $binary
  property on DownloadResponse) to CashupControllerTest,
  EmployeesControllerTest, ItemKitsControllerTest for asserting
  streamed download content
- Add exportAll CSV/PDF tests for Attributes, Customers,
  Expenses_categories, Expenses, Giftcards, ItemKits, Cashup,
  Employees controllers
- Add export_helperTest covering CSV sanitization (formula injection
  guard), JSON/XML/SQL writers, tag sanitization, and file generation
- Add Tests/Support/ExportFixtureTrait with reusable fixture objects
  for sales, employees, customers, suppliers, items, giftcards,
  item kits, attributes, expenses, cashups, tax rates
- Update AGENTS.md: clarify `use` import rule applies to every
  reference including global-namespace classes
  (ReflectionClass/ReflectionProperty/Exception) and method-signature
  type-hints, not just namespaced app classes

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
2026-10-21 15:47:09 +04:00