first(); $plus = Plan::where('slug', 'plus')->first(); $account = Account::factory()->create(['plan_id' => $starter->id]); expect(Feature::for($account)->value(WorkspaceLimit::class))->toBe($starter->workspace_limit); expect(Feature::for($account)->value(SocialAccountLimit::class))->toBe($starter->social_account_limit); expect(Feature::for($account)->value(MemberLimit::class))->toBe($starter->member_limit); expect(Feature::for($account)->value(AiImagesLimit::class))->toBe($starter->ai_images_limit); $account->update(['plan_id' => $plus->id]); $account->load('plan'); expect(Feature::for($account)->value(WorkspaceLimit::class))->toBe($plus->workspace_limit); expect(Feature::for($account)->value(SocialAccountLimit::class))->toBe($plus->social_account_limit); expect(Feature::for($account)->value(MemberLimit::class))->toBe($plus->member_limit); expect(Feature::for($account)->value(AiImagesLimit::class))->toBe($plus->ai_images_limit); }); test('booted hook does not flush pennant when other fields change', function () { $plan = Plan::where('slug', 'plus')->first(); $account = Account::factory()->create(['plan_id' => $plan->id]); Feature::for($account)->value(WorkspaceLimit::class); $cachedRow = DB::table('features') ->where('scope', 'account|'.$account->id) ->first(); expect($cachedRow)->not->toBeNull(); $account->update(['name' => 'Updated Name']); $stillCachedRow = DB::table('features') ->where('scope', 'account|'.$account->id) ->first(); expect($stillCachedRow->id)->toBe($cachedRow->id); });