aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/regression
diff options
context:
space:
mode:
authorSteve Clay <steve@mrclay.org>2013-06-01 21:51:32 -0400
committerSteve Clay <steve@mrclay.org>2013-06-01 21:51:32 -0400
commit2e979f75cd625c42ac5251140a3e7a797108f669 (patch)
tree49926f10be0ab24da3d72541addbce44272c6637 /engine/tests/regression
parentc7572e614606396617cb1611653f6a759be0a058 (diff)
downloadelgg-2e979f75cd625c42ac5251140a3e7a797108f669.tar.gz
elgg-2e979f75cd625c42ac5251140a3e7a797108f669.tar.bz2
Add filtering for site entities, faster filtering
Diffstat (limited to 'engine/tests/regression')
-rw-r--r--engine/tests/regression/trac_bugs.php35
1 files changed, 19 insertions, 16 deletions
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php
index 180fb5112..d7bb20f3b 100644
--- a/engine/tests/regression/trac_bugs.php
+++ b/engine/tests/regression/trac_bugs.php
@@ -297,31 +297,34 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest {
}
}
- /**
- * Checks if additional select columns does not leak to entity attributes.
- *
- * https://github.com/Elgg/Elgg/issues/5538
- */
- public function test_sql_selects_leak_to_attributes() {
+ /**
+ * 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
+
+ // 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);
+ $group->access_id = ACCESS_PUBLIC;
+ $this->assertTrue($group->save() !== false);
- //entity cache interferes with our test
+ // 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('42 as added_col'),
- 'limit' => 1,
+ 'type' => $type,
+ 'selects' => array('1 as _nonexistent_test_column'),
+ 'limit' => 1,
));
- $entity = array_shift($entities);
- $this->assertTrue($entity instanceof ElggEntity);
- $this->assertEqual($entity->added_col, null, "Additional select columns are leaking to attributes for " . get_class($entity));
+ 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();