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:
Diffstat (limited to 'plugins/UsersManager/tests/Integration/UserPreferencesTest.php')
-rw-r--r--plugins/UsersManager/tests/Integration/UserPreferencesTest.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/plugins/UsersManager/tests/Integration/UserPreferencesTest.php b/plugins/UsersManager/tests/Integration/UserPreferencesTest.php
index d7a442065f..bf17cf688e 100644
--- a/plugins/UsersManager/tests/Integration/UserPreferencesTest.php
+++ b/plugins/UsersManager/tests/Integration/UserPreferencesTest.php
@@ -36,6 +36,38 @@ class UserPreferencesTest extends IntegrationTestCase
$this->userPreferences = new UserPreferences();
$this->setSuperUser();
+
+ $identity = FakeAccess::$identity;
+ FakeAccess::$identity = 'foo'; // avoids error user already exists when it doesn't
+ APIUsersManager::getInstance()->addUser($identity, '22111214k4,mdw<L', 'foo@example.com');
+ FakeAccess::$identity = $identity;
+ }
+
+ /**
+ * @expectedException \Exception
+ * @expectedExceptionMessage User does not exist
+ */
+ public function test_getDefaultReport_WhenLoginNotExists()
+ {
+ APIUsersManager::getInstance()->setUserPreference(
+ 'foo',
+ APIUsersManager::PREFERENCE_DEFAULT_REPORT,
+ '1'
+ );
+ }
+
+
+ /**
+ * @expectedException \Exception
+ * @expectedExceptionMessage Not supported preference name
+ */
+ public function test_getDefaultReport_WhenWrongPreference()
+ {
+ APIUsersManager::getInstance()->setUserPreference(
+ Piwik::getCurrentUserLogin(),
+ 'foo',
+ '1'
+ );
}
public function test_getDefaultReport_ShouldReturnFalseByDefault()