diff options
-rw-r--r-- | phpBB/includes/nestedset/base.php | 28 | ||||
-rw-r--r-- | phpBB/includes/nestedset/exception.php | 20 | ||||
-rw-r--r-- | tests/nestedset/set_forum_move_test.php | 8 |
3 files changed, 18 insertions, 38 deletions
diff --git a/phpBB/includes/nestedset/base.php b/phpBB/includes/nestedset/base.php index 328621a68d..da6c056313 100644 --- a/phpBB/includes/nestedset/base.php +++ b/phpBB/includes/nestedset/base.php @@ -150,7 +150,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface if (!$this->lock->acquire()) { - throw new phpbb_nestedset_exception($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); + throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); } $action = ($delta > 0) ? 'move_up' : 'move_down'; @@ -168,7 +168,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface if (!$item) { $this->lock->release(); - throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_ITEM'); + throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } /** @@ -291,19 +291,19 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface if (!$current_parent_id) { - throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_ITEM'); + throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } if (!$this->lock->acquire()) { - throw new phpbb_nestedset_exception($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); + throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); } $item_data = $this->get_children_branch_data($current_parent_id); if (!isset($item_data[$current_parent_id])) { $this->lock->release(); - throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_ITEM'); + throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } $current_parent = $item_data[$current_parent_id]; @@ -319,7 +319,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface if (in_array($new_parent_id, $move_items)) { $this->lock->release(); - throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_PARENT'); + throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } $diff = sizeof($move_items) * 2; @@ -343,7 +343,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface { $this->db->sql_transaction('rollback'); $this->lock->release(); - throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_PARENT'); + throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } $new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true); @@ -400,19 +400,19 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface if (!$item_id) { - throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_ITEM'); + throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } if (!$this->lock->acquire()) { - throw new phpbb_nestedset_exception($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); + throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); } $item_data = $this->get_children_branch_data($item_id); if (!isset($item_data[$item_id])) { $this->lock->release(); - throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_ITEM'); + throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } $item = $item_data[$item_id]; @@ -421,7 +421,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface if (in_array($new_parent_id, $move_items)) { $this->lock->release(); - throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_PARENT'); + throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } $diff = sizeof($move_items) * 2; @@ -445,7 +445,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface { $this->db->sql_transaction('rollback'); $this->lock->release(); - throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_PARENT'); + throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } $new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true); @@ -612,7 +612,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface { if (!$table_already_locked && !$this->lock->acquire()) { - throw new phpbb_nestedset_exception($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); + throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); } $diff = sizeof($subset_items) * 2; @@ -702,7 +702,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface { if (!$this->lock->acquire()) { - throw new phpbb_nestedset_exception($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); + throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); } $this->db->sql_transaction('begin'); diff --git a/phpBB/includes/nestedset/exception.php b/phpBB/includes/nestedset/exception.php deleted file mode 100644 index 10937d0b29..0000000000 --- a/phpBB/includes/nestedset/exception.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** -* -* @package Nested Set -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -class phpbb_nestedset_exception extends \Exception -{ -} diff --git a/tests/nestedset/set_forum_move_test.php b/tests/nestedset/set_forum_move_test.php index 166fe666f2..90fc1c5468 100644 --- a/tests/nestedset/set_forum_move_test.php +++ b/tests/nestedset/set_forum_move_test.php @@ -383,7 +383,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se /** * @dataProvider move_children_throws_item_data * - * @expectedException phpbb_nestedset_exception + * @expectedException OutOfBoundsException * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_ITEM */ public function test_move_children_throws_item($explain, $forum_id, $target_id) @@ -403,7 +403,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se /** * @dataProvider move_children_throws_parent_data * - * @expectedException phpbb_nestedset_exception + * @expectedException OutOfBoundsException * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_PARENT */ public function test_move_children_throws_parent($explain, $forum_id, $target_id) @@ -539,7 +539,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se /** * @dataProvider change_parent_throws_item_data * - * @expectedException phpbb_nestedset_exception + * @expectedException OutOfBoundsException * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_ITEM */ public function test_change_parent_throws_item($explain, $forum_id, $target_id) @@ -559,7 +559,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se /** * @dataProvider change_parent_throws_parent_data * - * @expectedException phpbb_nestedset_exception + * @expectedException OutOfBoundsException * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_PARENT */ public function test_change_parent_throws_parent($explain, $forum_id, $target_id) |