- New Cost_Tracker class: logs every API call (model, tokens, cost), enforces monthly budgets with hard-stop mode, provides aggregated reporting - New llm_costs database table with indexes on created_at, model, operation - Modified LLM class: call_openrouter_with_usage() extracts token usage from OpenRouter responses; budget gate checks before each API call - Admin settings: monthly budget (USD), enforcement mode (disabled/warn/hard-stop), cost log retention period - Admin cost dashboard: budget progress bar, daily cost chart (Chart.js), per-model and per-operation breakdowns, recent API call log - PHPUnit tests: 16 tests covering cost calculation, pricing lookups, budget enforcement logic, and model validation - Updated ARCHITECTURE.md with new table schema, data flow, and key decisions - Updated CONVENTIONS.md with "how to add cost tracking for a new operation" - Version bump to 2.4.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
768 B
XML
Executable File
27 lines
768 B
XML
Executable File
<?xml version="1.0"?>
|
|
<phpunit
|
|
bootstrap="tests/bootstrap.php"
|
|
backupGlobals="false"
|
|
colors="true"
|
|
convertErrorsToExceptions="true"
|
|
convertNoticesToExceptions="true"
|
|
convertWarningsToExceptions="true"
|
|
>
|
|
<testsuites>
|
|
<testsuite name="unit">
|
|
<directory suffix="Test.php">./tests/unit</directory>
|
|
</testsuite>
|
|
</testsuites>
|
|
|
|
<coverage processUncoveredFiles="true">
|
|
<include>
|
|
<directory suffix=".php">./includes</directory>
|
|
<directory suffix=".php">./admin</directory>
|
|
<directory suffix=".php">./public</directory>
|
|
</include>
|
|
<exclude>
|
|
<directory suffix=".php">./admin/partials</directory>
|
|
</exclude>
|
|
</coverage>
|
|
</phpunit>
|