Update partner packages, copy, and demo switcher
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user