cvs: pear /DB_NestedSet/tests UnitTest.php /DB_NestedSet/tests/NestedSet api.php manipulation.php query.php
| From: | Daniel Khan | Date: | Mon, 06 Oct 2003 20:05:46 +0000 |
| Subject: | cvs: pear /DB_NestedSet/tests UnitTest.php /DB_NestedSet/tests/NestedSet api.php manipulation.php query.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-13444@lists.php.net to get a copy of this message | ||
datenpunk Mon Oct 6 16:05:46 2003 EDT
Modified files:
/pear/DB_NestedSet/tests UnitTest.php
/pear/DB_NestedSet/tests/NestedSet api.php manipulation.php
query.php
Log:
- Additions and changes while cleaning up the main classes
Index: pear/DB_NestedSet/tests/UnitTest.php
diff -u pear/DB_NestedSet/tests/UnitTest.php:1.8 pear/DB_NestedSet/tests/UnitTest.php:1.9
--- pear/DB_NestedSet/tests/UnitTest.php:1.8 Wed Oct 1 19:07:46 2003
+++ pear/DB_NestedSet/tests/UnitTest.php Mon Oct 6 16:05:45 2003
@@ -5,7 +5,7 @@
*
* @author Daniel Khan <dk@webcluster.at>
* @package DB_NestedSetTest
-* @version $Revision: 1.8 $
+* @version $Revision: 1.9 $
* @access public
*/
class DB_NestedSetTest extends TestBase {
@@ -20,15 +20,25 @@
"r" => "r", // "r" must exist
"STREH" => "norder", // "order" must exist
"LEVEL" => "level", // "level" must exist
- "STRNA" => "name" // Custom - specify as many
fields you want
+ "STRNA" => "name", // Custom - specify as many
fields you want
+ "parent" => "parent" // Custom - specify as many
fields you want
);
- $db_driver = 'DB';
+ $db_driver = 'MDB';
$db_dsn = 'mysql://user:password@localhost/test';
$this->_NeSe = DB_NestedSet::factory($db_driver, $db_dsn, $params);
$this->_NeSe->setAttr(array
(
'node_table' => 'tb_nodes',
+ 'lock_table' => 'tb_locks',
+ 'lockTTL' => 5,
+ 'debug' => 0)
+ );
+
+ $this->_NeSe2 = DB_NestedSet::factory($db_driver, $db_dsn, $params);
+ $this->_NeSe2->setAttr(array
+ (
+ 'node_table' => 'tb_nodes2',
'lock_table' => 'tb_locks',
'lockTTL' => 5,
'debug' => 0)
Index: pear/DB_NestedSet/tests/NestedSet/api.php
diff -u pear/DB_NestedSet/tests/NestedSet/api.php:1.1 pear/DB_NestedSet/tests/NestedSet/api.php:1.2
--- pear/DB_NestedSet/tests/NestedSet/api.php:1.1 Wed Oct 1 19:07:47 2003
+++ pear/DB_NestedSet/tests/NestedSet/api.php Mon Oct 6 16:05:46 2003
@@ -12,8 +12,7 @@
$node_c1 = $this->_NeSe->createLeftNode($node_a1, $values);
$values['STRNA'] = 'B1';
- $node_b1 = $this->_NeSe->createRightNode($node_a1, $values, true);
-
+ $node_b1 = $this->_NeSe->createRightNode($node_a1, $values);
// B1-1 Branch
$values['STRNA'] = 'B1-1';
@@ -26,8 +25,11 @@
$node_b1111 = $this->_NeSe->createSubNode($node_b111, $values);
$values['STRNA'] = 'B1-1-2';
- $node_b112 = $this->_NeSe->createRightNode($node_b111, $values, true);
-
+ $node_b112 = $this->_NeSe->createRightNode($node_b111, $values);
+
+ $values['STRNA'] = 'A1t';
+ $node_a1t = $this->_NeSe->createRightNode($node_b111, $values);
+
// B1-2 Branch
$values['STRNA'] = 'B1-2';
$node_b12 = $this->_NeSe->createSubNode($node_b1, $values);
@@ -76,6 +78,17 @@
$this->_indentTree($subbranch_b11_byname_pre);
$this->_indentTree($parents_b111_byname_pre);
$this->_indentTree($children_b12_byname_pre);
+ }
+
+ function test_convertModel() {
+ $rnc = 3;
+ $depth = 1;
+ $npl = 2;
+ $this->_createSubNode($rnc, $depth, $npl);
+ DB_NestedSet::convertTreeModel($this->_NeSe, $this->_NeSe2);
+ $this->_NeSe->sortmode = NESE_SORT_LEVEL;
+ $this->_NeSe2->sortmode = NESE_SORT_LEVEL;
+ $this->assertEquals($this->_NeSe->getAllNodes(true),
$this->_NeSe2->getAllNodes(true), 'Converted tree should match original');
}
}
?>
Index: pear/DB_NestedSet/tests/NestedSet/manipulation.php
diff -u pear/DB_NestedSet/tests/NestedSet/manipulation.php:1.2
pear/DB_NestedSet/tests/NestedSet/manipulation.php:1.3
--- pear/DB_NestedSet/tests/NestedSet/manipulation.php:1.2 Wed Oct 1 19:07:47 2003
+++ pear/DB_NestedSet/tests/NestedSet/manipulation.php Mon Oct 6 16:05:46 2003
@@ -5,7 +5,7 @@
*
* @author Daniel Khan <dk@webcluster.at>
* @package DB_NestedSetTest
-* @version $Revision: 1.2 $
+* @version $Revision: 1.3 $
* @access public
*/
@@ -109,6 +109,7 @@
// Just make sure that all the nodes are still there
$this->assertFalse(count(array_diff(array_keys($allnodes1),
array_keys($allnodes2))), 'Nodes got lost during the move');
}
+ return true;
}
Index: pear/DB_NestedSet/tests/NestedSet/query.php
diff -u pear/DB_NestedSet/tests/NestedSet/query.php:1.1
pear/DB_NestedSet/tests/NestedSet/query.php:1.2
--- pear/DB_NestedSet/tests/NestedSet/query.php:1.1 Thu Sep 25 09:50:04 2003
+++ pear/DB_NestedSet/tests/NestedSet/query.php Mon Oct 6 16:05:46 2003
@@ -5,7 +5,7 @@
*
* @author Daniel Khan <dk@webcluster.at>
* @package DB_NestedSetTest
-* @version $Revision: 1.1 $
+* @version $Revision: 1.2 $
* @access public
*/
@@ -28,7 +28,6 @@
* @return bool True on completion
*/
function test_getAllNodes() {
-
$rnc = 3;
$depth = 2;
$npl = 3;
@@ -106,6 +105,7 @@
}
return true;
}
+
/**
* tests_NestedSet_common::test_getParent()