cvs: pear /Tree/tests getElement.php

From: Date: Tue, 24 Jun 2003 11:29:31 +0000
Subject: cvs: pear /Tree/tests getElement.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-11153@lists.php.net to get a copy of this message
cain Tue Jun 24 07:29:31 2003 EDT Modified files: /pear/Tree/tests getElement.php Log: - added a test on an empty tree Index: pear/Tree/tests/getElement.php diff -u pear/Tree/tests/getElement.php:1.1 pear/Tree/tests/getElement.php:1.2 --- pear/Tree/tests/getElement.php:1.1 Fri Jun 20 12:54:51 2003 +++ pear/Tree/tests/getElement.php Tue Jun 24 07:29:31 2003 @@ -1,6 +1,6 @@ <?php // -// $Id: getElement.php,v 1.1 2003/06/20 16:54:51 cain Exp $ +// $Id: getElement.php,v 1.2 2003/06/24 11:29:31 cain Exp $ // require_once 'UnitTest.php'; @@ -52,7 +52,31 @@ $actual = $tree->getElement(3); $this->assertEquals('PEAR rulez',$actual['myComment']); } - + + /** + * Empty the tree and add an element, retreive it and check if it is the one we added. + * + * + */ + function test_DynamicDBnestedEmptyTree() + { + $tree = Tree::setup('Dynamic_DBnested',DB_DSN,array('table'=>TABLE_TREENESTED)); + $tree->remove($tree->getRootId()); + + $tree = Tree::setup('Memory_DBnested',DB_DSN,array('table'=>TABLE_TREENESTED)); + $tree->setup(); + $id = $tree->add(array('name'=>'Start')); + $tree->setup(); + $el = $tree->getElement($id); + $this->assertEquals('Start',$el['name']); + $tree->remove($tree->getRootId()); + + $tree = Tree::setup('Dynamic_DBnested',DB_DSN,array('table'=>TABLE_TREENESTED)); + $id = $tree->add(array('name'=>'StartDyn')); + $el = $tree->getElement($id); + $this->assertEquals('StartDyn',$el['name']); + } + } ?>

« previous php.pear.cvs (#11153) next »