diff options
author | Steve Clay <steve@mrclay.org> | 2013-06-01 21:55:22 -0400 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2013-06-01 21:55:22 -0400 |
commit | b2af2df3b5c89869e83ce5ee66d8368b3addef35 (patch) | |
tree | 3731b21f89a5bbb2cc69c98c972b96b33013021f /engine/tests/regression/trac_bugs.php | |
parent | 8d1e8f8c4cbb3e269d36c9867884eef2490dfc60 (diff) | |
parent | 2e979f75cd625c42ac5251140a3e7a797108f669 (diff) | |
download | elgg-b2af2df3b5c89869e83ce5ee66d8368b3addef35.tar.gz elgg-b2af2df3b5c89869e83ce5ee66d8368b3addef35.tar.bz2 |
Merge branch '5539_18' into 1.8
Diffstat (limited to 'engine/tests/regression/trac_bugs.php')
-rw-r--r-- | engine/tests/regression/trac_bugs.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php index 051aa8d1b..5730830bb 100644 --- a/engine/tests/regression/trac_bugs.php +++ b/engine/tests/regression/trac_bugs.php @@ -296,4 +296,37 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest { $this->assertEqual($output, parse_urls($input)); } } + + /** + * Ensure additional select columns do not end up in entity attributes. + * + * https://github.com/Elgg/Elgg/issues/5538 + */ + public function test_extra_columns_dont_appear_in_attributes() { + global $ENTITY_CACHE; + + // may not have groups in DB - let's create one + $group = new ElggGroup(); + $group->name = 'test_group'; + $group->access_id = ACCESS_PUBLIC; + $this->assertTrue($group->save() !== false); + + // entity cache interferes with our test + $ENTITY_CACHE = array(); + + foreach (array('site', 'user', 'group', 'object') as $type) { + $entities = elgg_get_entities(array( + 'type' => $type, + 'selects' => array('1 as _nonexistent_test_column'), + 'limit' => 1, + )); + if (!$this->assertTrue($entities, "Query for '$type' did not return an entity.")) { + continue; + } + $entity = $entities[0]; + $this->assertNull($entity->_nonexistent_test_column, "Additional select columns are leaking to attributes for '$type'"); + } + + $group->delete(); + } } |