diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2012-12-18 15:55:42 -0500 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2012-12-18 15:55:42 -0500 |
commit | 2b08c9d03b803c8227a99a4c3fce3ecb84ed6fc4 (patch) | |
tree | e22771dd91ef304562f79e6bc010c82d6946eb9e /engine/tests/api/access_collections.php | |
parent | b691e4e2c002ef83c0c2e2bbd74885d4828b5c67 (diff) | |
download | elgg-2b08c9d03b803c8227a99a4c3fce3ecb84ed6fc4.tar.gz elgg-2b08c9d03b803c8227a99a4c3fce3ecb84ed6fc4.tar.bz2 |
Fixes #3940. Cleaned up caching for access functions. Access caches are now cleared on ignore access change.
Diffstat (limited to 'engine/tests/api/access_collections.php')
-rw-r--r-- | engine/tests/api/access_collections.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php index bea995a6e..ebcd7d318 100644 --- a/engine/tests/api/access_collections.php +++ b/engine/tests/api/access_collections.php @@ -268,4 +268,26 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest { $group->delete(); } + + public function testAccessCaching() { + // create a new user to check against + $user = new ElggUser(); + $user->username = 'access_test_user'; + $user->save(); + + foreach (array('get_access_list', 'get_access_array') as $func) { + $cache = _elgg_get_access_cache(); + $cache->clear(); + + // admin users run tests, so disable access + elgg_set_ignore_access(true); + $access = $func($user->getGUID()); + + elgg_set_ignore_access(false); + $access2 = $func($user->getGUID()); + $this->assertNotEqual($access, $access2, "Access test for $func"); + } + + $user->delete(); + } } |