<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminPlatformOrderCreateOrderTypeRenewalOptionDisabledWhenNoSubscriptionTest extends TestCase
{
    use RefreshDatabase;

    protected function loginAsPlatformAdmin(): void
    {
        $this->seed();

        $this->post('/admin/login', [
            'email' => 'platform.admin@demo.local',
            'password' => 'Platform@123456',
        ])->assertRedirect('/admin');
    }

    public function test_create_form_should_disable_renewal_order_type_when_site_subscription_id_missing(): void
    {
        $this->loginAsPlatformAdmin();

        $res = $this->get('/admin/platform-orders/create');
        $res->assertOk();

        $res->assertSee('value="renewal" disabled', false);
        $res->assertSee('续费单必须绑定订阅', false);
    }
}
