diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2013-04-25 13:40:25 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2013-04-25 13:40:25 +0200 |
| commit | 4bff28a0eeaf44eae9e99725ead6ff2cf770b857 (patch) | |
| tree | e85d6f46367bbe7111abc60579d8a6cad51b62d6 /tests | |
| parent | 61e72d3a1000c48146466305c6693595324f5282 (diff) | |
| download | forums-4bff28a0eeaf44eae9e99725ead6ff2cf770b857.tar forums-4bff28a0eeaf44eae9e99725ead6ff2cf770b857.tar.gz forums-4bff28a0eeaf44eae9e99725ead6ff2cf770b857.tar.bz2 forums-4bff28a0eeaf44eae9e99725ead6ff2cf770b857.tar.xz forums-4bff28a0eeaf44eae9e99725ead6ff2cf770b857.zip | |
[ticket/11495] Rename fix function to regenerate_left_right_ids()
This method regenerates the left/right ids for the nested set based on the
parent/child relations. This function executes three queries per item, so
it should only be called, when the set has one of the following problems:
- The set has a duplicated value inside the left/right id chain
- The set has a missing value inside the left/right id chain
- The set has items that do not have a left/right is set
When regenerating the items, the items are sorted by parent id and their
current left id, so the current child/parent relationships are kept and
running the function on a working set will not change any orders.
PHPBB3-11495
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/nestedset/set_forum_regenerate_test.php (renamed from tests/nestedset/set_forum_recalculate_test.php) | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/nestedset/set_forum_recalculate_test.php b/tests/nestedset/set_forum_regenerate_test.php index 6ff7a372a4..0e3a2123a0 100644 --- a/tests/nestedset/set_forum_recalculate_test.php +++ b/tests/nestedset/set_forum_regenerate_test.php @@ -9,7 +9,7 @@ require_once dirname(__FILE__) . '/set_forum_base.php'; -class phpbb_tests_nestedset_set_forum_recalculate_test extends phpbb_tests_nestedset_set_forum_base +class phpbb_tests_nestedset_set_forum_regenerate_test extends phpbb_tests_nestedset_set_forum_base { protected $fixed_set = array( array('forum_id' => 1, 'parent_id' => 0, 'left_id' => 1, 'right_id' => 6, 'forum_parents' => ''), @@ -27,7 +27,7 @@ class phpbb_tests_nestedset_set_forum_recalculate_test extends phpbb_tests_neste array('forum_id' => 11, 'parent_id' => 7, 'left_id' => 20, 'right_id' => 21, 'forum_parents' => ''), ); - public function recalculate_nested_set_data() + public function regenerate_left_right_ids_data() { return array( array('UPDATE phpbb_forums @@ -56,13 +56,13 @@ class phpbb_tests_nestedset_set_forum_recalculate_test extends phpbb_tests_neste } /** - * @dataProvider recalculate_nested_set_data + * @dataProvider regenerate_left_right_ids_data */ - public function test_recalculate_nested_set($breaking_query, $reset_ids) + public function test_regenerate_left_right_ids($breaking_query, $reset_ids) { $result = $this->db->sql_query($breaking_query); - $this->assertEquals(23, $this->set->recalculate_nested_set(1, 0, $reset_ids)); + $this->assertEquals(23, $this->set->regenerate_left_right_ids(1, 0, $reset_ids)); $result = $this->db->sql_query('SELECT forum_id, parent_id, left_id, right_id, forum_parents FROM phpbb_forums |
