Update of /cvsroot/phpvortex/phpvortex/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19270/test
Added Files:
.htaccess README.txt vortex_test.php vortex_test.sql
Log Message:
Added some test files to show some basic functionality
--- NEW FILE: .htaccess ---
php_value include_path ".;.."
php_value auto_prepend_file "d_header.php"
php_value auto_append_file "d_footer.php"
--- NEW FILE: vortex_test.sql ---
CREATE DATABASE IF NOT EXISTS vortex_test;
USE vortex_test;
DROP TABLE IF EXISTS phones;
CREATE TABLE phones (
ph_id int(3) unsigned NOT NULL auto_increment,
ph_name varchar(250) NOT NULL default '',
ph_phone varchar(250) NOT NULL default '',
PRIMARY KEY (ph_id)
) TYPE=MyISAM;
--- NEW FILE: vortex_test.php ---
<?php
require_once('../DB_MySQL.class.php');
require_once('../TB_Base.class.php');
require_once('../FT_Text.class.php');
?>
<html>
<head>
<title>Test PHP Vortex Functionality</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
class TB_Teste extends TB_Base {
function TB_Teste(&$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'));
$this->fields['ph_phone'] =& new FT_Text($db, array('name' => 'ph_phone'));
TB_Base::TB_Base($db);
}
}
$db =& new DB_MySQL(array('server' => 'localhost', 'db' => 'vortex_test', 'user' => 'root', 'pw' => ''));
$db->Connect();
$tb =& new TB_Teste($db);
$id = $tb->Save(array('ph_id' => '-1', 'ph_name' => 'Test', 'ph_phone' => '555-5551')) or print('Error(Save): '.$tb->Error());
echo 'Added ID:'.$id.'<br>';
$tb->Seek(array('ph_name' => 'Test'), FALSE) or print('Error(Seek): '.$tb->Error());
echo 'Seek ID:'.$tb->data['ph_id'].'<br>';
d('Snapshot', $tb);
$tb->Delete() or print('Error(Delete): '.$tb->Error());
echo 'Deleted<br>';
$db->Close();
?>
</body>
</html>
--- NEW FILE: README.txt ---
Instructions for test setup:
1 - Put PHP Vortex and all subfolders somewhere inside your htdocs folder.
2 - Execute the vortex_test.sql in your database server (only MySQL supported for now).
It will create a vortex_test database, and some test tables.
3 - If your server does't use .htaccess files, configure it to set the PHP include directory to your PHP Vortex folder.
4 - Change server and username/password to the database server in the test files if you use something more restricting than a 'root'/'' setup.
5 - Open in your web browser the page test.php and see it working. (Use test.php?debug=3 for some cool debug info)
6 - If something went wrong, send us a message with the problem and we will try to figure out what happened.
|