summaryrefslogtreecommitdiff
path: root/core/tests
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-12-07 19:45:46 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-12-07 19:45:46 +0000
commit954fcf034238458f292c9f5ec72c6d4b101aac0d (patch)
treee6d5c6d850137e13d970d4f349f6ebf2103fc749 /core/tests
parentb409a376f3689e51bb50f9716c1384d9b2013832 (diff)
Merge gallery3/branches/menus back into gallery3/trunk
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/Menu_Test.php73
1 files changed, 73 insertions, 0 deletions
diff --git a/core/tests/Menu_Test.php b/core/tests/Menu_Test.php
new file mode 100644
index 00000000..978e5555
--- /dev/null
+++ b/core/tests/Menu_Test.php
@@ -0,0 +1,73 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2008 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class Menu_Test extends Unit_Test_Case {
+ public function find_menu_item_test() {
+ $test_menu = new Menu();
+ $test_menu->append(new Menu("test1"));
+ $test_menu->append(new Menu("test2"));
+ $expected = new Menu("test3");
+ $test_menu->append($expected);
+ $test_menu->append(new Menu("test4"));
+
+ $menu_item = $test_menu->get("test3");
+ $this->assert_equal($expected, $menu_item);
+ }
+
+ public function insert_before_test() {
+ $expected = new Menu();
+ $expected->append(new Menu("test-2"));
+ $expected->append(new Menu("test0"));
+ $expected->append(new Menu("test1"));
+ $expected->append(new Menu("test1b"));
+ $expected->append(new Menu("test2"));
+ $expected->append(new Menu("test4"));
+
+ $test_menu = new Menu();
+ $test_menu->append(new Menu("test1"));
+ $test_menu->append(new Menu("test2"));
+ $test_menu->append(new Menu("test4"));
+ $test_menu->insert_before("test2", new Menu("test1b"));
+ $test_menu->insert_before("test1", new Menu("test0"));
+ $test_menu->insert_before("test-1", new Menu("test-2"));
+
+ $this->assert_equal($expected, $test_menu);
+ }
+
+ public function insert_after_test() {
+ $expected = new Menu();
+ $expected->append(new Menu("test1"));
+ $expected->append(new Menu("test2"));
+ $expected->append(new Menu("test3"));
+ $expected->append(new Menu("test4"));
+ $expected->append(new Menu("test5"));
+ $expected->append(new Menu("test7"));
+
+ $test_menu = new Menu();
+ $test_menu->append(new Menu("test1"));
+ $test_menu->append(new Menu("test2"));
+ $test_menu->append(new Menu("test4"));
+ $test_menu->insert_after("test2", new Menu("test3"));
+ $test_menu->insert_after("test4", new Menu("test5"));
+ $test_menu->insert_after("test6", new Menu("test7"));
+
+ $this->assert_equal($expected, $test_menu);
+ }
+
+} \ No newline at end of file