withoutMiddleware(EnsurePlatformSession::class); config([ 'billing.api_url' => 'https://ladill.com/api/billing', 'billing.api_key' => 'events-billing-key', 'events.pro.enabled' => false, ]); } private function user(): User { return User::factory()->create(['public_id' => 'usr_'.uniqid()]); } public function test_subscriptions_are_retired(): void { $svc = app(SubscriptionService::class); $user = $this->user(); $this->assertFalse($svc->gatingActive()); $this->assertTrue($svc->hasPaidPlan($user)); $this->assertTrue($svc->canCreateEvent($user)); $this->assertFalse($svc->canUsePaymentGateway($user)); } public function test_pro_routes_redirect_to_dashboard(): void { $this->actingAs($this->user()) ->get(route('events.pro.index')) ->assertRedirect(route('events.dashboard')); $this->actingAs($this->user()) ->post(route('events.pro.subscribe')) ->assertRedirect(route('events.dashboard')); } public function test_owner_gateway_is_never_used(): void { $user = $this->user(); PaymentGatewaySetting::create([ 'owner_ref' => $user->public_id, 'provider' => PaymentGatewaySetting::PROVIDER_PAYSTACK, 'public_key' => 'pk_test', 'secret_key' => 'sk_test', 'is_active' => true, ]); $this->assertFalse(app(MerchantGatewayService::class)->shouldUseOwnerGateway($user)); $this->assertFalse(app(MerchantGatewayService::class)->isConfigured($user)); } }