cvs: pear /DB_NestedSet/tests TestBase.php UnitTest.php testdb.sql /DB_NestedSet/tests/NestedSet query.php

From: Date: Tue, 25 Oct 2005 21:32:07 +0000
Subject: cvs: pear /DB_NestedSet/tests TestBase.php UnitTest.php testdb.sql /DB_NestedSet/tests/NestedSet query.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35858@lists.php.net to get a copy of this message
datenpunk Tue Oct 25 17:32:07 2005 EDT Added files: /pear/DB_NestedSet/tests testdb.sql Modified files: /pear/DB_NestedSet/tests TestBase.php UnitTest.php /pear/DB_NestedSet/tests/NestedSet query.php Log: Fixed a compatibilty problem with phpUnit. assertEquals() was used wrong. Added a (my)SQL schema for tests. http://cvs.php.net/diff.php/pear/DB_NestedSet/tests/TestBase.php?r1=1.13&r2=1.14&ty=u Index: pear/DB_NestedSet/tests/TestBase.php diff -u pear/DB_NestedSet/tests/TestBase.php:1.13 pear/DB_NestedSet/tests/TestBase.php:1.14 --- pear/DB_NestedSet/tests/TestBase.php:1.13 Tue Aug 3 18:34:28 2004 +++ pear/DB_NestedSet/tests/TestBase.php Tue Oct 25 17:32:06 2005 @@ -6,7 +6,7 @@ * * @author Daniel Khan <dk@webcluster.at> * @package DB_NestedSetTest - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ * @access public */ Class TestBase extends PhpUnit_Testcase { @@ -258,7 +258,7 @@ $exp_name = 'Node ' . $nodeIndex; } // Test Array - $this->assertEquals(is_array($node[$nodes[$i]]), "Rootnode $nodeIndex: No array given."); + $this->assertTrue(is_array($node[$nodes[$i]]), "Rootnode $nodeIndex: No array given."); // Test NodeID==RootID $this->assertEquals($node[$nodes[$i]]['id'], $node[$nodes[$i]]['rootid'], "Rootnode $nodeIndex: NodeID/RootID not equal."); // Test lft/rgt @@ -322,7 +322,7 @@ $exp_rgt = $prgt - 1; $exp_rootid = $pnode['rootid']; // Test Array - $this->assertEquals(is_array($nnode), "Node {$values['STRNA']}: No array given."); + $this->assertTrue(is_array($nnode), "Node {$values['STRNA']}: No array given."); // Test rootid $this->assertEquals($exp_rootid, $nnode['rootid'], "Node {$values['STRNA']}: Wrong rootid"); // Test lft/rgt http://cvs.php.net/diff.php/pear/DB_NestedSet/tests/UnitTest.php?r1=1.22&r2=1.23&ty=u Index: pear/DB_NestedSet/tests/UnitTest.php diff -u pear/DB_NestedSet/tests/UnitTest.php:1.22 pear/DB_NestedSet/tests/UnitTest.php:1.23 --- pear/DB_NestedSet/tests/UnitTest.php:1.22 Thu Jul 29 07:31:55 2004 +++ pear/DB_NestedSet/tests/UnitTest.php Tue Oct 25 17:32:06 2005 @@ -5,7 +5,7 @@ * * @author Daniel Khan <dk@webcluster.at> * @package DB_NestedSetTest -* @version $Revision: 1.22 $ +* @version $Revision: 1.23 $ * @access public */ class DB_NestedSetTest extends TestBase { @@ -23,7 +23,7 @@ "STRNA" => "name", // Custom - specify as many fields you want "parent" => "parent", // Custom - specify as many fields you want "tkey" => "tkey" // Custom - specify as many fields you want - ); + ); $db_driver = 'DB'; $db_dsn = 'mysql://user:password@localhost/test'; http://cvs.php.net/diff.php/pear/DB_NestedSet/tests/NestedSet/query.php?r1=1.5&r2=1.6&ty=u Index: pear/DB_NestedSet/tests/NestedSet/query.php diff -u pear/DB_NestedSet/tests/NestedSet/query.php:1.5 pear/DB_NestedSet/tests/NestedSet/query.php:1.6 --- pear/DB_NestedSet/tests/NestedSet/query.php:1.5 Thu Apr 1 19:15:06 2004 +++ pear/DB_NestedSet/tests/NestedSet/query.php Tue Oct 25 17:32:06 2005 @@ -5,7 +5,7 @@ * * @author Daniel Khan <dk@webcluster.at> * @package DB_NestedSetTest - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * @access public */ @@ -280,7 +280,7 @@ // Pick the current node and do the tests $nnode = $this->_NeSe->pickNode($nid, true, true, 'id', $this->addSQL); // Test Array - $this->assertEquals(is_array($nnode), "Node $nname: No array given."); + $this->assertTrue(is_array($nnode), "Node $nname: No array given."); // Test lft/rgt $this->assertEquals(1, $nnode['l'], "Node $nname: Wrong LFT"); $this->assertEquals(2, $nnode['r'], "Node $nname: Wrong RGT"); http://cvs.php.net/co.php/pear/DB_NestedSet/tests/testdb.sql?r=1.1&p=1 Index: pear/DB_NestedSet/tests/testdb.sql +++ pear/DB_NestedSet/tests/testdb.sql # $Id: testdb.sql,v 1.1 2005/10/25 21:32:06 datenpunk Exp $ # Use this schema if you want to run the unit tests bundled with DB_NestedSet CREATE TABLE tb_locks ( lockID char(32) NOT NULL default '', lockTable char(32) NOT NULL default '', lockStamp int(11) NOT NULL default '0', PRIMARY KEY (lockID,lockTable) ) TYPE=MyISAM COMMENT='Table locks for NestedSet'; CREATE TABLE tb_nodes ( STRID int(11) NOT NULL auto_increment, ROOTID int(11) NOT NULL default '0', l int(11) NOT NULL default '0', r int(11) NOT NULL default '0', parent int(11) NOT NULL default '0', STREH int(11) NOT NULL default '0', LEVEL int(11) NOT NULL default '0', STRNA char(128) NOT NULL default '', tkey char(32) NOT NULL default '', PRIMARY KEY (STRID), KEY ROOTID (ROOTID), KEY STREH (STREH), KEY l (l), KEY r (r), KEY LEVEL (LEVEL), KEY SRLR (ROOTID,l,r), KEY parent (parent) ) TYPE=MyISAM COMMENT='NestedSet table'; CREATE TABLE tb_nodes2 ( STRID int(11) NOT NULL auto_increment, ROOTID int(11) NOT NULL default '0', l int(11) NOT NULL default '0', r int(11) NOT NULL default '0', parent int(11) NOT NULL default '0', STREH int(11) NOT NULL default '0', LEVEL int(11) NOT NULL default '0', STRNA char(128) NOT NULL default '', tkey char(32) NOT NULL default '', PRIMARY KEY (STRID), KEY ROOTID (ROOTID), KEY STREH (STREH), KEY l (l), KEY r (r), KEY LEVEL (LEVEL), KEY SRLR (ROOTID,l,r), KEY parent (parent) ) TYPE=MyISAM COMMENT='NestedSet table';

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