From a803f0a6098d7a0e5b52fe387fc5b20a64fe83bd Mon Sep 17 00:00:00 2001 From: Peter Gribanov Date: Mon, 12 Jul 2021 17:14:40 +0300 Subject: [PATCH 1/2] test custom url and custom path --- .../DependencyInjection/ConfigurationTest.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index a13f283..782a40b 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -272,6 +272,46 @@ public function getConfigs(): iterable ]]; } + yield [$cache_dir, [ + 'gpslab_geoip' => [ + 'license' => 'LICENSE', + 'edition' => 'GeoLite2-City', + 'url' => 'https://example.com/GeoLite2-City.tar.gz', + ], + ], [ + 'default_database' => 'default', + 'databases' => [ + 'default' => [ + 'license' => 'LICENSE', + 'edition' => 'GeoLite2-City', + 'url' => 'https://example.com/GeoLite2-City.tar.gz', + 'path' => sprintf(self::PATH, $real_cache_dir, 'GeoLite2-City'), + 'locales' => ['en'], + ], + ], + 'locales' => ['en'], + ]]; + + yield [$cache_dir, [ + 'gpslab_geoip' => [ + 'license' => 'LICENSE', + 'edition' => 'GeoLite2-City', + 'path' => '%kernel.project_dir%/var/GeoLite2-City.mmdb', + ], + ], [ + 'default_database' => 'default', + 'databases' => [ + 'default' => [ + 'license' => 'LICENSE', + 'edition' => 'GeoLite2-City', + 'path' => '%kernel.project_dir%/var/GeoLite2-City.mmdb', + 'url' => sprintf(self::URL, 'GeoLite2-City', 'LICENSE'), + 'locales' => ['en'], + ], + ], + 'locales' => ['en'], + ]]; + yield [$cache_dir, [ 'gpslab_geoip' => [ 'default_database' => 'foo', From 007029058dcbaed62a49fe5fe579a93b915e6cde Mon Sep 17 00:00:00 2001 From: Peter Gribanov Date: Mon, 12 Jul 2021 18:28:00 +0300 Subject: [PATCH 2/2] add license and edition in all configuration examples --- README.md | 8 ++++++++ tests/DependencyInjection/ConfigurationTest.php | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b419a39..05609de 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,8 @@ URL in the configuration. ```yml gpslab_geoip: + license: 'XXXXXXXXXXXXXXXX' + edition: 'GeoLite2-City' url: 'https://example.com/GeoLite2-City.tar.gz' ``` @@ -73,6 +75,8 @@ environment may not be optimal. You can choose a common directory for all enviro ```yml gpslab_geoip: + license: 'XXXXXXXXXXXXXXXX' + edition: 'GeoLite2-City' path: '%kernel.project_dir%/var/GeoLite2-City.mmdb' ``` @@ -83,6 +87,8 @@ locales for fallback. ```yml gpslab_geoip: + license: 'XXXXXXXXXXXXXXXX' + edition: 'GeoLite2-City' locales: [ 'ru', 'en' ] ``` @@ -192,6 +198,8 @@ gpslab_geoip: locales: [ 'fr' ] # customize locales city: edition: 'GeoLite2-City' + url: 'https://example.com/GeoLite2-City.tar.gz' # customize url + path: '%kernel.project_dir%/var/GeoLite2-City.mmdb' # customize path country: edition: 'GeoLite2-Country' license: 'YYYYYYYYYYYYYYYY' # customize license diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index 782a40b..004066e 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -324,6 +324,8 @@ public function getConfigs(): iterable 'license' => 'LICENSE_2', 'edition' => 'GeoLite2-City', 'locales' => ['ru'], + 'url' => 'https://example.com/GeoLite2-City.tar.gz', + 'path' => '%kernel.project_dir%/var/GeoLite2-City.mmdb', ], 'baz' => [ 'license' => 'LICENSE_3', @@ -346,8 +348,8 @@ public function getConfigs(): iterable 'license' => 'LICENSE_2', 'edition' => 'GeoLite2-City', 'locales' => ['ru'], - 'url' => sprintf(self::URL, 'GeoLite2-City', 'LICENSE_2'), - 'path' => sprintf(self::PATH, $real_cache_dir, 'GeoLite2-City'), + 'url' => 'https://example.com/GeoLite2-City.tar.gz', + 'path' => '%kernel.project_dir%/var/GeoLite2-City.mmdb', ], 'baz' => [ 'license' => 'LICENSE_3',