Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsgiehl <stefan@piwik.org>2016-11-04 01:04:16 +0300
committersgiehl <stefan@piwik.org>2016-11-07 22:32:56 +0300
commitee03ee1b7999abe644dc67b21c6ad97c8ad881a0 (patch)
tree51a3a52d0b813c306bda45723bcad48483826e35 /plugins/UserCountry/tests/Integration/APITest.php
parent1fcb31b597828b541fc29ca305d76d450b5ea85c (diff)
adds missing config check in api and some more tests
Diffstat (limited to 'plugins/UserCountry/tests/Integration/APITest.php')
-rw-r--r--plugins/UserCountry/tests/Integration/APITest.php38
1 files changed, 34 insertions, 4 deletions
diff --git a/plugins/UserCountry/tests/Integration/APITest.php b/plugins/UserCountry/tests/Integration/APITest.php
index 5be24ea326..a424048258 100644
--- a/plugins/UserCountry/tests/Integration/APITest.php
+++ b/plugins/UserCountry/tests/Integration/APITest.php
@@ -8,15 +8,16 @@
namespace Piwik\Plugins\UserCountry\tests;
+use Piwik\Access;
use Piwik\Common;
+use Piwik\Config;
use Piwik\Plugins\UserCountry\API;
use Piwik\Plugins\UserCountry\LocationProvider;
use Piwik\Plugins\UserCountry\LocationProvider\DefaultProvider;
-use Piwik\Tests\Framework\Mock\FakeAccess;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * @group UserCountryAPI
+ * @group UserCountry
* @group APITest
* @group Plugins
*/
@@ -31,8 +32,6 @@ class APITest extends IntegrationTestCase
{
parent::setUp();
- FakeAccess::$superUser = true;
-
$this->api = API::getInstance();
// reset location providers as they might be manipulated by other tests
@@ -50,4 +49,35 @@ class APITest extends IntegrationTestCase
$this->api->setLocationProvider($locationProvider);
$this->assertEquals($locationProvider, Common::getCurrentLocationProviderId());
}
+
+ /**
+ * @expectedException \Exception
+ */
+ public function test_setLocationProviderInvalid()
+ {
+ $locationProvider = 'invalidProvider';
+ $this->api->setLocationProvider($locationProvider);
+ }
+
+ /**
+ * @expectedException \Exception
+ */
+ public function test_setLocationProviderNoSuperUser()
+ {
+ Access::getInstance()->setSuperUserAccess(false);
+
+ $locationProvider = LocationProvider\GeoIp\Php::ID;
+ $this->api->setLocationProvider($locationProvider);
+ }
+
+ /**
+ * @expectedException \Exception
+ */
+ public function test_setLocationProviderDisabledInConfig()
+ {
+ Config::getInstance()->General['enable_geolocation_admin'] = 0;
+
+ $locationProvider = LocationProvider\GeoIp\Php::ID;
+ $this->api->setLocationProvider($locationProvider);
+ }
}