Update partner packages, copy, and demo switcher
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-15 17:33:36 +01:00
parent 2f93271d94
commit ad829ae509
50 changed files with 1335 additions and 411 deletions

View File

@@ -146,4 +146,39 @@ class TenantModelTest extends TestCase
$this->assertFalse($tenant->features['analytics']);
}
public function test_consume_event_allowance_moves_to_next_credit_batch(): void
{
$tenant = Tenant::factory()->create();
$firstPackage = Package::factory()->reseller()->create([
'max_events_per_year' => 1,
]);
$secondPackage = Package::factory()->reseller()->create([
'max_events_per_year' => 1,
]);
$firstBatch = TenantPackage::factory()->for($tenant)->for($firstPackage)->create([
'used_events' => 0,
'active' => true,
'expires_at' => null,
'purchased_at' => now()->subDay(),
]);
$secondBatch = TenantPackage::factory()->for($tenant)->for($secondPackage)->create([
'used_events' => 0,
'active' => true,
'expires_at' => null,
'purchased_at' => now(),
]);
$this->assertTrue($tenant->consumeEventAllowance());
$this->assertFalse($firstBatch->fresh()->active);
$this->assertTrue($secondBatch->fresh()->active);
$this->assertTrue($tenant->consumeEventAllowance());
$this->assertFalse($secondBatch->fresh()->active);
$this->assertFalse($tenant->consumeEventAllowance());
}
}