[PHPVortex-Commit] phpvortex/test TB_Test.class.php,NONE,1.1 vortex_test.php,1.9,1.10 vortex_test.sq
Brought to you by:
nop144666
From: Thiago R. <nop...@us...> - 2004-10-07 18:31:36
|
Update of /cvsroot/phpvortex/phpvortex/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24453/test Modified Files: vortex_test.php vortex_test.sql vortex_test_page.php Added Files: TB_Test.class.php Log Message: Test programs: Placed TB_Test into a class file, added some example data to the test database and started a demonstration of the SEC_List in vortex_test_page.php Index: vortex_test_page.php =================================================================== RCS file: /cvsroot/phpvortex/phpvortex/test/vortex_test_page.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** vortex_test_page.php 6 Oct 2004 19:51:49 -0000 1.2 --- vortex_test_page.php 7 Oct 2004 18:31:26 -0000 1.3 *************** *** 10,13 **** --- 10,19 ---- */ + /** Require the header for MySQL database access. */ + require_once('../DB_MySQL.class.php'); + /** Require the header for the utility URL class. */ + require_once('../URL.class.php'); + /** Require the header for the Test Table class. */ + require_once('TB_Test.class.php'); /** Require the header for SEC_Page functionality. */ require_once('../SEC_Page.class.php'); *************** *** 20,36 **** */ class Test_Page extends SEC_Page { ! function Test_Page() { parent::SEC_Page(array( 'header' => array( 'class' => 'SEC_Header', 'opts' => array( ! 'title' => 'SEC_Page test page', ! 'styles' => array('tests.css') ) ), 'content' => array( ! 'class' => 'SEC_Static', 'opts' => array( ! 'code' => 'Page content' ) ) --- 26,50 ---- */ class Test_Page extends SEC_Page { ! function Test_Page(&$table) { parent::SEC_Page(array( 'header' => array( 'class' => 'SEC_Header', 'opts' => array( ! 'title' => 'SEC_Page and SEC_List test page', ! 'styles' => array('tests.css', 'vortex_test.css') ) ), 'content' => array( ! 'class' => 'SEC_List', 'opts' => array( ! 'table' => &$table, ! 'url' => new URL(), ! 'navigator' => array( ! 'class' => 'SEC_ListNavigator', ! 'opts' => array( ! 'url' => new URL() ! ) ! ), ! 'recspage' => 2 ) ) *************** *** 39,43 **** } ! $page =& new Test_Page; $page->Show(); ?> \ No newline at end of file --- 53,64 ---- } ! $db =& new DB_MySQL(array('server' => 'localhost', 'db' => 'vortex_test', 'user' => 'root', 'pw' => '')); ! $db->Connect(); ! ! $tb =& new TB_Test($db); ! ! $page =& new Test_Page($tb); $page->Show(); + + $db->Close(); ?> \ No newline at end of file Index: vortex_test.sql =================================================================== RCS file: /cvsroot/phpvortex/phpvortex/test/vortex_test.sql,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** vortex_test.sql 30 Sep 2004 20:46:54 -0000 1.1 --- vortex_test.sql 7 Oct 2004 18:31:26 -0000 1.2 *************** *** 8,9 **** --- 8,19 ---- PRIMARY KEY (ph_id) ) TYPE=MyISAM; + + INSERT INTO phones VALUES (NULL, 'Test 1', '555-5551'); + INSERT INTO phones VALUES (NULL, 'Test 2', '555-5552'); + INSERT INTO phones VALUES (NULL, 'Test 3', '555-5553'); + INSERT INTO phones VALUES (NULL, 'Test 4', '555-5554'); + INSERT INTO phones VALUES (NULL, 'Test 5', '555-5555'); + INSERT INTO phones VALUES (NULL, 'Test 6', '555-5556'); + INSERT INTO phones VALUES (NULL, 'Test 7', '555-5557'); + INSERT INTO phones VALUES (NULL, 'Test 8', '555-5558'); + INSERT INTO phones VALUES (NULL, 'Test 9', '555-5559'); \ No newline at end of file --- NEW FILE: TB_Test.class.php --- <?php /** * File for class TB_Test. * * @package Vortex * @subpackage Debug * @author Thiago Ramon Gonçalves Montoya * @copyright Copyright 2004, Thiago Ramon Gonçalves Montoya * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License */ /** Require the header for Table functionality. */ require_once('../TB_Base.class.php'); /** Require the header for the field used in the test database. */ require_once('../FT_Text.class.php'); /** * Testing class. * * @package Vortex * @subpackage Debug */ class TB_Test extends TB_Base { function TB_Test(&$db) { $this->name = 'phones'; $this->fields['ph_id'] =& new FT_Text($db, array('name' => 'ph_id', 'pkey' => TRUE, 'required' => TRUE)); $this->fields['ph_name'] =& new FT_Text($db, array('name' => 'ph_name', 'label' => 'Name', 'required' => TRUE)); $this->fields['ph_phone'] =& new FT_Text($db, array('name' => 'ph_phone', 'label' => 'Phone', 'required' => TRUE)); $this->fields_list[] =& $this->fields['ph_name']; $this->fields_list[] =& $this->fields['ph_phone']; $this->fields_form[] =& $this->fields['ph_name']; $this->fields_form[] =& $this->fields['ph_phone']; $this->list_order = 'ph_name'; TB_Base::TB_Base($db); } } ?> Index: vortex_test.php =================================================================== RCS file: /cvsroot/phpvortex/phpvortex/test/vortex_test.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** vortex_test.php 6 Oct 2004 19:50:40 -0000 1.9 --- vortex_test.php 7 Oct 2004 18:31:26 -0000 1.10 *************** *** 12,21 **** /** Require the header for MySQL database access. */ require_once('../DB_MySQL.class.php'); - /** Require the header for Table functionality. */ - require_once('../TB_Base.class.php'); - /** Require the header for the field used in the test database. */ - require_once('../FT_Text.class.php'); /** Require the header for the utility URL class. */ require_once('../URL.class.php'); ?> <html> --- 12,20 ---- /** Require the header for MySQL database access. */ require_once('../DB_MySQL.class.php'); /** Require the header for the utility URL class. */ require_once('../URL.class.php'); + /** Require the header for the Test Table class. */ + require_once('TB_Test.class.php'); + ?> <html> *************** *** 29,53 **** <body> <?php - /** - * Testing class. - * - * @package Vortex - * @subpackage Debug - */ - class TB_Test extends TB_Base { - function TB_Test(&$db) { - $this->name = 'phones'; - $this->fields['ph_id'] =& new FT_Text($db, array('name' => 'ph_id', 'pkey' => TRUE, 'required' => TRUE)); - $this->fields['ph_name'] =& new FT_Text($db, array('name' => 'ph_name', 'label' => 'Name', 'required' => TRUE)); - $this->fields['ph_phone'] =& new FT_Text($db, array('name' => 'ph_phone', 'label' => 'Phone', 'required' => TRUE)); - $this->fields_list[] =& $this->fields['ph_name']; - $this->fields_list[] =& $this->fields['ph_phone']; - $this->fields_form[] =& $this->fields['ph_name']; - $this->fields_form[] =& $this->fields['ph_phone']; - $this->list_order = 'ph_name'; - TB_Base::TB_Base($db); - } - } - $db =& new DB_MySQL(array('server' => 'localhost', 'db' => 'vortex_test', 'user' => 'root', 'pw' => '')); $db->Connect(); --- 28,31 ---- |