Files
portal-api/tests/Feature/ProductBillingCyclesTest.php

26 lines
908 B
PHP

<?php
namespace Tests\Feature;
use App\Support\ProductBillingCycles;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ProductBillingCyclesTest extends TestCase
{
use RefreshDatabase;
public function test_defaults_and_saved_cycles(): void
{
$this->assertSame(['annually'], ProductBillingCycles::forType('domain'));
$this->assertContains('monthly', ProductBillingCycles::forType('vps'));
ProductBillingCycles::save(['hosting' => ['monthly', 'annually'], 'domain' => ['annually', 'biennially']]);
$this->assertSame(['monthly', 'annually'], ProductBillingCycles::forType('hosting'));
$this->assertTrue(ProductBillingCycles::allows('domain', 'biennially'));
$this->assertFalse(ProductBillingCycles::allows('hosting', 'quarterly'));
$this->assertTrue(ProductBillingCycles::allows('hosting', 'onetime'));
}
}