From 94dee77647a7ae1a263632a156b5afc14722ad6a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 25 Apr 2013 16:50:11 +0200 Subject: [PATCH] [ticket/11495] Replace fixtures content with manual calls Should be easier to maintain PHPBB3-11495 --- tests/nestedset/fixtures/phpbb_forums.xml | 110 ---------------------- tests/nestedset/set_forum_base.php | 25 +++++ 2 files changed, 25 insertions(+), 110 deletions(-) diff --git a/tests/nestedset/fixtures/phpbb_forums.xml b/tests/nestedset/fixtures/phpbb_forums.xml index 016c8ea7c5..8f133078a9 100644 --- a/tests/nestedset/fixtures/phpbb_forums.xml +++ b/tests/nestedset/fixtures/phpbb_forums.xml @@ -9,115 +9,5 @@ forum_name forum_desc forum_rules - - 1 - 0 - 1 - 6 - - Parent with two flat children - - - - - 2 - 1 - 2 - 3 - - Flat child #1 - - - - - 3 - 1 - 4 - 5 - - Flat child #2 - - - - - 4 - 0 - 7 - 12 - - Parent with two nested children - - - - - 5 - 4 - 8 - 11 - - Nested child #1 - - - - - 6 - 5 - 9 - 10 - - Nested child #2 - - - - - 7 - 0 - 13 - 22 - - Parent with flat and nested children - - - - - 8 - 7 - 14 - 15 - - Mixed child #1 - - - - - 9 - 7 - 16 - 19 - - Mixed child #2 - - - - - 10 - 9 - 17 - 18 - - Nested child #1 of Mixed child #2 - - - - - 11 - 7 - 20 - 21 - - Mixed child #3 - - - diff --git a/tests/nestedset/set_forum_base.php b/tests/nestedset/set_forum_base.php index 4523f12897..93d4dc3522 100644 --- a/tests/nestedset/set_forum_base.php +++ b/tests/nestedset/set_forum_base.php @@ -57,5 +57,30 @@ class phpbb_tests_nestedset_set_forum_base extends phpbb_database_test_case $this->lock = new phpbb_lock_db('nestedset_forum_lock', $this->config, $this->db); $this->set = new phpbb_nestedset_forum($this->db, $this->lock, 'phpbb_forums'); + + $this->set_up_forums(); + } + + protected function set_up_forums() + { + $this->create_forum('Parent with two flat children'); + $this->create_forum('Flat child #1', 1); + $this->create_forum('Flat child #2', 1); + + $this->create_forum('Parent with two nested children'); + $this->create_forum('Nested child #1', 4); + $this->create_forum('Nested child #2', 5); + + $this->create_forum('Parent with flat and nested children'); + $this->create_forum('Mixed child #1', 7); + $this->create_forum('Mixed child #2', 7); + $this->create_forum('Nested child #1 of Mixed child #2', 9); + $this->create_forum('Mixed child #3', 7); + } + + protected function create_forum($name, $parent_id = 0) + { + $forum = $this->set->insert(array('forum_name' => $name, 'forum_desc' => '', 'forum_rules' => '')); + $this->set->change_parent($forum['forum_id'], $parent_id); } }