File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -497,4 +497,24 @@ public function testMostSpecificSubdivisionWithNoSubdivisions(): void
497497 'mostSpecificSubdivision is set even on an empty response '
498498 );
499499 }
500+
501+ // We do not expect well-formed databases from MaxMind to have empty
502+ // subdivisions arrays, but we support it due to encountering a third-party
503+ // database that had them.
504+ public function testEmptySubdivisionsArray (): void
505+ {
506+ $ raw = [
507+ 'subdivisions ' => [],
508+ 'traits ' => ['ip_address ' => '1.1.1.1 ' ],
509+ ];
510+
511+ $ model = new Insights ($ raw , ['en ' ]);
512+
513+ $ this ->assertCount (0 , $ model ->subdivisions );
514+
515+ $ this ->assertInstanceOf (
516+ 'GeoIp2\Record\Subdivision ' ,
517+ $ model ->mostSpecificSubdivision
518+ );
519+ }
500520}
You can’t perform that action at this time.
0 commit comments