CluPilotCloud/tests/Feature/Provisioning/CustomerStepBaseTest.php

30 lines
1.0 KiB
PHP

<?php
use App\Models\Instance;
use App\Models\Order;
use App\Models\ProvisioningRun;
use Tests\Support\Steps\ProbeCustomerStep;
it('resolves order, instance and plan from the run', function () {
$order = Order::factory()->withSubscription()->create(['plan' => 'team']);
$instance = Instance::factory()->create();
$run = ProvisioningRun::factory()->create([
'subject_type' => Order::class,
'subject_id' => $order->id,
'pipeline' => 'customer',
'context' => ['instance_id' => $instance->id],
]);
$step = new ProbeCustomerStep;
expect($step->orderOf($run)->is($order))->toBeTrue()
->and($step->instanceOf($run)->is($instance))->toBeTrue()
->and($step->planOf($run)['quota_gb'])->toBe(500)
->and($step->label())->toBe('provisioning.step.probe');
});
it('registers the 15-step customer pipeline in config', function () {
expect(config('provisioning.pipelines.customer'))->toHaveCount(15)
->and(config('provisioning.plans.start.template_vmid'))->toBe(9000);
});