File: /home/xedaptot/ai.naniguide.com/tests/Feature/PlanQuotaFeatureTest.php
<?php
/**
* Plan quota and options feature tests.
*
* Tests plan model behavior, options parsing, and quota enforcement logic.
*/
use App\Model\Plan;
test('plan status constants are defined', function () {
expect(Plan::STATUS_ACTIVE)->toBe('active');
expect(Plan::STATUS_INACTIVE)->toBe('inactive');
});
test('plan model accepts attributes', function () {
$plan = new Plan([
'name' => 'Pro Plan',
'price' => 29.99,
'frequency_amount' => 1,
'frequency_unit' => 'month',
]);
expect($plan->name)->toBe('Pro Plan');
expect((float) $plan->price)->toBe(29.99);
expect((int) $plan->frequency_amount)->toBe(1);
expect($plan->frequency_unit)->toBe('month');
});
test('plan uses plans table', function () {
$plan = new Plan();
expect($plan->getTable())->toBe('plans');
});
test('plan frequency units are valid', function () {
$validUnits = ['day', 'week', 'month', 'year'];
foreach ($validUnits as $unit) {
$plan = new Plan(['frequency_unit' => $unit]);
expect($plan->frequency_unit)->toBe($unit);
}
});