@@ -666,6 +666,99 @@ public function test_team_member_with_own_subscription_sees_regular_price_for_th
666666 $ this ->assertEquals (4900 , $ bestPrice ->amount );
667667 }
668668
669+ // ---- Ultra subscribers without a team ----
670+
671+ public function test_ultra_subscriber_without_team_has_access_to_official_plugin (): void
672+ {
673+ $ user = User::factory ()->create ();
674+ $ this ->createPaidMaxSubscription ($ user );
675+ $ plugin = $ this ->createOfficialPlugin ();
676+
677+ // User has Ultra subscription but no team created
678+ $ this ->assertNull ($ user ->ownedTeam );
679+ $ this ->assertTrue ($ user ->hasPluginAccess ($ plugin ));
680+ }
681+
682+ public function test_ultra_subscriber_without_team_does_not_have_access_to_third_party_plugin (): void
683+ {
684+ $ user = User::factory ()->create ();
685+ $ this ->createPaidMaxSubscription ($ user );
686+ $ plugin = $ this ->createThirdPartyPlugin ();
687+
688+ $ this ->assertFalse ($ user ->hasPluginAccess ($ plugin ));
689+ }
690+
691+ public function test_comped_ultra_subscriber_without_team_has_access_to_official_plugin (): void
692+ {
693+ $ user = User::factory ()->create ();
694+ $ this ->createCompedUltraSubscription ($ user );
695+ $ plugin = $ this ->createOfficialPlugin ();
696+
697+ $ this ->assertNull ($ user ->ownedTeam );
698+ $ this ->assertTrue ($ user ->hasPluginAccess ($ plugin ));
699+ }
700+
701+ public function test_legacy_comped_max_without_team_does_not_have_access_to_official_plugin (): void
702+ {
703+ $ user = User::factory ()->create ();
704+ $ this ->createCompedMaxSubscription ($ user );
705+ $ plugin = $ this ->createOfficialPlugin ();
706+
707+ $ this ->assertFalse ($ user ->hasPluginAccess ($ plugin ));
708+ }
709+
710+ public function test_satis_api_includes_official_plugins_for_ultra_subscriber_without_team (): void
711+ {
712+ $ user = User::factory ()->create ([
713+ 'plugin_license_key ' => 'ultra-no-team-key ' ,
714+ ]);
715+ $ this ->createPaidMaxSubscription ($ user );
716+
717+ $ plugin = Plugin::factory ()->create ([
718+ 'name ' => 'nativephp/secure-storage ' ,
719+ 'type ' => PluginType::Paid,
720+ 'status ' => PluginStatus::Approved,
721+ 'is_active ' => true ,
722+ 'is_official ' => true ,
723+ ]);
724+
725+ $ response = $ this ->withHeaders ([
726+ 'X-API-Key ' => config ('services.bifrost.api_key ' ),
727+ 'Authorization ' => 'Basic ' .base64_encode ("{$ user ->email }:ultra-no-team-key " ),
728+ ])->getJson ('/api/plugins/access ' );
729+
730+ $ response ->assertStatus (200 );
731+
732+ $ pluginNames = array_column ($ response ->json ('plugins ' ), 'name ' );
733+ $ this ->assertContains ('nativephp/secure-storage ' , $ pluginNames );
734+ }
735+
736+ public function test_satis_check_access_returns_true_for_ultra_subscriber_without_team (): void
737+ {
738+ $ user = User::factory ()->create ([
739+ 'plugin_license_key ' => 'ultra-no-team-key ' ,
740+ ]);
741+ $ this ->createPaidMaxSubscription ($ user );
742+
743+ Plugin::factory ()->create ([
744+ 'name ' => 'nativephp/secure-storage ' ,
745+ 'type ' => PluginType::Paid,
746+ 'status ' => PluginStatus::Approved,
747+ 'is_active ' => true ,
748+ 'is_official ' => true ,
749+ ]);
750+
751+ $ response = $ this ->withHeaders ([
752+ 'X-API-Key ' => config ('services.bifrost.api_key ' ),
753+ 'Authorization ' => 'Basic ' .base64_encode ("{$ user ->email }:ultra-no-team-key " ),
754+ ])->getJson ('/api/plugins/access/nativephp/secure-storage ' );
755+
756+ $ response ->assertStatus (200 )
757+ ->assertJson ([
758+ 'has_access ' => true ,
759+ ]);
760+ }
761+
669762 // ---- Comped Ultra subscriptions ----
670763
671764 public function test_comped_ultra_user_has_active_ultra_subscription (): void
0 commit comments