-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Flaviu Chelaru edited this page Nov 25, 2019
·
1 revision
Welcome to the phalcon-nested-sets wiki!
Regression testing
Based on the basic structure attached (mysql), the following operations should be checked
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
DROP TABLE IF EXISTS `categories`;
CREATE TABLE IF NOT EXISTS `categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(50) DEFAULT NULL,
`parent_id` int(11) DEFAULT NULL,
`lft` int(11) DEFAULT NULL,
`rgt` int(11) DEFAULT NULL,
`depth` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DELETE FROM `categories`;
/*!40000 ALTER TABLE `categories` DISABLE KEYS */;
INSERT INTO `categories` (`id`, `name`, `parent_id`, `lft`, `rgt`, `depth`) VALUES
(1, 'online', 0, 1, 14, 0),
(2, 'back-end', 0, 15, 28, 0),
(3, 'back-end', 0, 29, 42, 0),
(4, 'wireless', 1, 2, 3, 1),
(5, 'neural', 1, 4, 11, 1),
(6, 'auxiliary', 1, 12, 13, 1),
(7, 'multi-byte', 2, 16, 17, 1),
(8, 'wireless', 2, 18, 25, 1),
(9, 'optical', 2, 26, 27, 1),
(10, 'auxiliary', 3, 30, 31, 1),
(11, 'cross-platform', 3, 32, 39, 1),
(12, 'wireless', 3, 40, 41, 1),
(13, 'back-end', 5, 5, 6, 2),
(14, 'redundant', 5, 7, 8, 2),
(15, 'haptic', 5, 9, 10, 2),
(16, 'virtual', 8, 19, 20, 2),
(17, 'bluetooth', 8, 21, 22, 2),
(18, 'multi-byte', 8, 23, 24, 2),
(19, 'open-source', 11, 33, 34, 2),
(20, 'haptic', 11, 35, 36, 2),
(21, 'back-end', 11, 37, 38, 2);
/*!40000 ALTER TABLE `categories` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
scenarios
-
create categories
-
delete root category (delete #1)
-
delete sub-tree category (delete #5)
-
delete leaf category (delete #13)
-
move root category as leaf in the same sub-tree (id 1, parent 13)
-
move root category as leaf in different sub-tree (id 1, parent 17)
-
move sub-tree category to root (id5)
-
move sub-tree category as leaf (id5, parent 13)
-
move sub-tree category as sub-tree for another root (id 5, parent 17)
-
move leaf category as leaf in another subtree (id 14, parent 8)
-
move leaf category as root (id 14, parent null)