diff options
author | Matthieu Aubry <matt@piwik.org> | 2014-12-16 05:53:38 +0300 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2014-12-16 05:53:38 +0300 |
commit | 0d55fb656ece0d793cd9374c0aff818823d82bed (patch) | |
tree | 27959fbdda79225adeffca18f1f23faaebe40ff7 /plugins/UsersManager/tests/Integration | |
parent | 3fe19974b4a9a24583f41852fcba42c386d900f3 (diff) | |
parent | 0ab6b13eed19a12ee0c52a8b459b8ee8fb3a2afe (diff) |
Merge pull request #6856 from piwik/6672_preprocess_ranges2.10.0-b7
during core:archive console command, preprocess any custom date ranges that were selected in any User's Preferences
Diffstat (limited to 'plugins/UsersManager/tests/Integration')
-rw-r--r-- | plugins/UsersManager/tests/Integration/APITest.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/plugins/UsersManager/tests/Integration/APITest.php b/plugins/UsersManager/tests/Integration/APITest.php index 1cf2cf71bb..67a6e9f12e 100644 --- a/plugins/UsersManager/tests/Integration/APITest.php +++ b/plugins/UsersManager/tests/Integration/APITest.php @@ -69,4 +69,43 @@ class APITest extends IntegrationTestCase $this->assertFalse($eventTriggered, 'UsersManager.removeSiteAccess event was triggered but should not'); } + public function test_getAllUsersPreferences_isEmpty_whenNoPreference() + { + $preferences = $this->api->getAllUsersPreferences(array('preferenceName')); + $this->assertEmpty($preferences); + } + + public function test_getAllUsersPreferences_isEmpty_whenNoPreferenceAndMultipleRequested() + { + $preferences = $this->api->getAllUsersPreferences(array('preferenceName', 'otherOne')); + $this->assertEmpty($preferences); + } + + public function test_getAllUsersPreferences_shouldGetMultiplePreferences() + { + $user2 = 'userLogin2'; + $user3 = 'userLogin3'; + $this->api->addUser($user2, 'password', 'userlogin2@password.de'); + $this->api->setUserPreference($user2, 'myPreferenceName', 'valueForUser2'); + $this->api->setUserPreference($user2, 'Random_NOT_REQUESTED', 'Random_NOT_REQUESTED'); + + $this->api->addUser($user3, 'password', 'userlogin3@password.de'); + $this->api->setUserPreference($user3, 'myPreferenceName', 'valueForUser3'); + $this->api->setUserPreference($user3, 'otherPreferenceHere', 'otherPreferenceVALUE'); + $this->api->setUserPreference($user3, 'Random_NOT_REQUESTED', 'Random_NOT_REQUESTED'); + + $expected = array( + $user2 => array( + 'myPreferenceName' => 'valueForUser2' + ), + $user3 => array( + 'myPreferenceName' => 'valueForUser3', + 'otherPreferenceHere' => 'otherPreferenceVALUE', + ), + ); + $result = $this->api->getAllUsersPreferences(array('myPreferenceName', 'otherPreferenceHere', 'randomDoesNotExist')); + + $this->assertSame($expected, $result); + } + } |