diff options
author | Paweł Sroka <srokap@gmail.com> | 2013-10-27 05:17:55 -0700 |
---|---|---|
committer | Paweł Sroka <srokap@gmail.com> | 2013-10-27 05:17:55 -0700 |
commit | e0b7270c6e770338259b1aa4bb919c81bb71eb13 (patch) | |
tree | 6d11ea37f618c4758331f3f4ae9659a5509c05a1 /engine/tests | |
parent | 882866430efa4374206fc7289e2a7ab70ac5abf8 (diff) | |
parent | 8a79dc3904a2fda8081216fdf52be6a462db2709 (diff) | |
download | elgg-e0b7270c6e770338259b1aa4bb919c81bb71eb13.tar.gz elgg-e0b7270c6e770338259b1aa4bb919c81bb71eb13.tar.bz2 |
Merge pull request #6184 from Srokap/pr/6121
#5952 - fix infinite loop when disabling > 50 annotations or metadata
Diffstat (limited to 'engine/tests')
-rw-r--r-- | engine/tests/regression/trac_bugs.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php index f823825ab..ef1348cf6 100644 --- a/engine/tests/regression/trac_bugs.php +++ b/engine/tests/regression/trac_bugs.php @@ -332,4 +332,45 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest { $group->delete(); } + + /** + * Ensure that ElggBatch doesn't go into infinite loop when disabling annotations recursively when show hidden is enabled. + * + * https://github.com/Elgg/Elgg/issues/5952 + */ + public function test_disabling_annotations_infinite_loop() { + + //let's have some entity + $group = new ElggGroup(); + $group->name = 'test_group'; + $group->access_id = ACCESS_PUBLIC; + $this->assertTrue($group->save() !== false); + + $total = 51; + //add some annotations + for ($cnt = 0; $cnt < $total; $cnt++) { + $group->annotate('test_annotation', 'value_' . $total); + } + + //disable them + $show_hidden = access_get_show_hidden_status(); + access_show_hidden_entities(true); + $options = array( + 'guid' => $group->guid, + 'limit' => $total, //using strict limit to avoid real infinite loop and just see ElggBatch limiting on it before finishing the work + ); + elgg_disable_annotations($options); + access_show_hidden_entities($show_hidden); + + //confirm all being disabled + $annotations = $group->getAnnotations(array( + 'limit' => $total, + )); + foreach ($annotations as $annotation) { + $this->assertTrue($annotation->enabled == 'no'); + } + + //delete group and annotations + $group->delete(); + } } |