File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ class GeoIPUpdater
2121 /**
2222 * @param array $config
2323 */
24- public function __construct (array $ config )
24+ public function __construct (array $ config, Requester $ requester = null )
2525 {
2626 $ this ->config = $ config ;
2727
28- $ this ->requester = with (new Requester (new GuzzleClient ()))->retry (2 )->every (50 );
28+ $ this ->requester = $ requester ?: with (new Requester (new GuzzleClient ()))->retry (2 )->every (50 );
2929 }
3030
3131 /**
Original file line number Diff line number Diff line change @@ -35,4 +35,22 @@ public function test_maxmind_updater()
3535
3636 unlink ($ database );
3737 }
38+
39+ public function test_maxmind_updater_dir_not_exist ()
40+ {
41+ $ database = __DIR__ .'/data/new_dir/GeoLite2-City.mmdb ' ;
42+ $ config = [
43+ 'driver ' => 'maxmind ' ,
44+ 'maxmind ' => [
45+ 'database ' => $ database ,
46+ ],
47+ ];
48+
49+ $ geoipUpdater = new \PulkitJalan \GeoIP \GeoIPUpdater ($ config );
50+
51+ $ this ->assertEquals ($ geoipUpdater ->update (), $ database );
52+
53+ unlink ($ database );
54+ rmdir (pathinfo ($ database , PATHINFO_DIRNAME ));
55+ }
3856}
You can’t perform that action at this time.
0 commit comments