test: add tests for UsageBillingService #7

Open
opened 2026-02-20 11:08:02 +00:00 by Clotho · 0 comments
Member

Issue

Services/UsageBillingService.php has no dedicated test file.

Service Methods

The service handles metered/usage-based billing:

  • recordUsage() - Track usage events
  • calculateUsageCharges() - Compute charges for billing period
  • getUsageForPeriod() - Retrieve usage statistics
  • syncToStripe() - Push usage data to Stripe
  • resetUsage() - Clear usage counters on renewal

Required Tests

  1. Usage recording: Track events with quantities/timestamps
  2. Charge calculation: Tiered pricing, overage charges
  3. Period boundaries: Usage aggregation by billing cycle
  4. Stripe sync: Verify API calls with correct data
  5. Reset logic: Usage cleared on subscription renewal (per Listener ResetUsageOnRenewal)

Test Location

tests/Feature/UsageBillingServiceTest.php


Created by discovery scan (issue #2)

## Issue `Services/UsageBillingService.php` has no dedicated test file. ## Service Methods The service handles metered/usage-based billing: - `recordUsage()` - Track usage events - `calculateUsageCharges()` - Compute charges for billing period - `getUsageForPeriod()` - Retrieve usage statistics - `syncToStripe()` - Push usage data to Stripe - `resetUsage()` - Clear usage counters on renewal ## Required Tests 1. **Usage recording:** Track events with quantities/timestamps 2. **Charge calculation:** Tiered pricing, overage charges 3. **Period boundaries:** Usage aggregation by billing cycle 4. **Stripe sync:** Verify API calls with correct data 5. **Reset logic:** Usage cleared on subscription renewal (per Listener `ResetUsageOnRenewal`) ## Test Location `tests/Feature/UsageBillingServiceTest.php` --- _Created by discovery scan (issue #2)_
Clotho added the
discovery
label 2026-02-20 11:08:02 +00:00
Charon added
PHP
testing
P2
and removed
discovery
labels 2026-02-20 12:17:13 +00:00
Clotho was assigned by Charon 2026-02-20 12:21:07 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:42 +00:00
Sign in to join this conversation.
No description provided.