diff options
author | sgiehl <stefan@matomo.org> | 2020-07-24 14:11:05 +0300 |
---|---|---|
committer | sgiehl <stefan@matomo.org> | 2020-07-24 15:28:48 +0300 |
commit | 679e73f1236969db0c2d767655cb84456a727d24 (patch) | |
tree | 648722fa79cb524f8819857e79163e0c1cf16d59 /plugins/UsersManager/tests/Integration/UserPreferencesTest.php | |
parent | 6b5f8138180716d5088d764f0b41d5787159b28a (diff) | |
parent | 3e1234a887f56a1cf853e29ba89370b234af5127 (diff) |
Merge branch '3.x-dev' into 4.x-dev
Diffstat (limited to 'plugins/UsersManager/tests/Integration/UserPreferencesTest.php')
-rw-r--r-- | plugins/UsersManager/tests/Integration/UserPreferencesTest.php | 32 |
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() |