@@ -27,6 +27,11 @@ public function testFull(): void
2727 'is_tor_exit_node ' => true ,
2828 'network_last_seen ' => '2025-04-14 ' ,
2929 'provider_name ' => 'NordVPN ' ,
30+ 'residential ' => [
31+ 'confidence ' => 82 ,
32+ 'network_last_seen ' => '2026-05-11 ' ,
33+ 'provider_name ' => 'quickshift ' ,
34+ ],
3035 ],
3136 'city ' => [
3237 'confidence ' => 76 ,
@@ -232,6 +237,30 @@ public function testFull(): void
232237 '$model->anonymizer->providerName is NordVPN '
233238 );
234239
240+ $ this ->assertInstanceOf (
241+ 'GeoIp2\Record\AnonymizerFeed ' ,
242+ $ model ->anonymizer ->residential ,
243+ '$model->anonymizer->residential '
244+ );
245+
246+ $ this ->assertSame (
247+ 82 ,
248+ $ model ->anonymizer ->residential ->confidence ,
249+ '$model->anonymizer->residential->confidence is 82 '
250+ );
251+
252+ $ this ->assertSame (
253+ '2026-05-11 ' ,
254+ $ model ->anonymizer ->residential ->networkLastSeen ,
255+ '$model->anonymizer->residential->networkLastSeen is 2026-05-11 '
256+ );
257+
258+ $ this ->assertSame (
259+ 'quickshift ' ,
260+ $ model ->anonymizer ->residential ->providerName ,
261+ '$model->anonymizer->residential->providerName is quickshift '
262+ );
263+
235264 $ this ->assertSame (
236265 15.37 ,
237266 $ model ->traits ->ipRiskSnapshot ,
@@ -385,13 +414,77 @@ public function testFull(): void
385414 'is_tor_exit_node ' => true ,
386415 'network_last_seen ' => '2025-04-14 ' ,
387416 'provider_name ' => 'NordVPN ' ,
417+ 'residential ' => [
418+ 'confidence ' => 82 ,
419+ 'network_last_seen ' => '2026-05-11 ' ,
420+ 'provider_name ' => 'quickshift ' ,
421+ ],
388422 ],
389423 ],
390424 $ model ->jsonSerialize (),
391425 'jsonSerialize returns initial array '
392426 );
393427 }
394428
429+ public function testAnonymizerResidentialOnly (): void
430+ {
431+ // The full-feed Residential Proxy database is a superset of the
432+ // residential proxies in Anonymous Plus, so the anonymizer object
433+ // may be present with only the residential key set.
434+ $ raw = [
435+ 'traits ' => ['ip_address ' => '6.0.42.17 ' ],
436+ 'anonymizer ' => [
437+ 'residential ' => [
438+ 'confidence ' => 95 ,
439+ 'network_last_seen ' => '2026-05-14 ' ,
440+ 'provider_name ' => 'novada ' ,
441+ ],
442+ ],
443+ ];
444+
445+ $ model = new Insights ($ raw , ['en ' ]);
446+
447+ $ this ->assertNull (
448+ $ model ->anonymizer ->confidence ,
449+ '$model->anonymizer->confidence is null '
450+ );
451+
452+ $ this ->assertFalse (
453+ $ model ->anonymizer ->isAnonymous ,
454+ '$model->anonymizer->isAnonymous is false '
455+ );
456+
457+ $ this ->assertInstanceOf (
458+ 'GeoIp2\Record\AnonymizerFeed ' ,
459+ $ model ->anonymizer ->residential ,
460+ '$model->anonymizer->residential '
461+ );
462+
463+ $ this ->assertSame (
464+ 95 ,
465+ $ model ->anonymizer ->residential ->confidence ,
466+ '$model->anonymizer->residential->confidence is 95 '
467+ );
468+
469+ $ this ->assertSame (
470+ '2026-05-14 ' ,
471+ $ model ->anonymizer ->residential ->networkLastSeen ,
472+ '$model->anonymizer->residential->networkLastSeen is 2026-05-14 '
473+ );
474+
475+ $ this ->assertSame (
476+ 'novada ' ,
477+ $ model ->anonymizer ->residential ->providerName ,
478+ '$model->anonymizer->residential->providerName is novada '
479+ );
480+
481+ $ this ->assertSame (
482+ $ raw ,
483+ $ model ->jsonSerialize (),
484+ 'jsonSerialize returns only the residential key in anonymizer '
485+ );
486+ }
487+
395488 public function testEmptyObjects (): void
396489 {
397490 $ raw = ['traits ' => ['ip_address ' => '5.6.7.8 ' , 'network ' => '5.6.7.0/24 ' ]];
@@ -458,6 +551,33 @@ public function testEmptyObjects(): void
458551 '$model->traits '
459552 );
460553
554+ $ this ->assertInstanceOf (
555+ 'GeoIp2\Record\Anonymizer ' ,
556+ $ model ->anonymizer ,
557+ '$model->anonymizer '
558+ );
559+
560+ $ this ->assertInstanceOf (
561+ 'GeoIp2\Record\AnonymizerFeed ' ,
562+ $ model ->anonymizer ->residential ,
563+ '$model->anonymizer->residential '
564+ );
565+
566+ $ this ->assertNull (
567+ $ model ->anonymizer ->residential ->confidence ,
568+ '$model->anonymizer->residential->confidence is null '
569+ );
570+
571+ $ this ->assertNull (
572+ $ model ->anonymizer ->residential ->networkLastSeen ,
573+ '$model->anonymizer->residential->networkLastSeen is null '
574+ );
575+
576+ $ this ->assertNull (
577+ $ model ->anonymizer ->residential ->providerName ,
578+ '$model->anonymizer->residential->providerName is null '
579+ );
580+
461581 $ this ->assertSame (
462582 $ raw ,
463583 $ model ->jsonSerialize (),
0 commit comments