From 193b8bf6852fb27e2b342151386c6e5bbad8f1a2 Mon Sep 17 00:00:00 2001 From: rurban Date: Mon, 15 Nov 2004 16:53:01 +0000 Subject: [PATCH] new tables, better options handling git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@4135 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- tests/unit/mysql-test-initialize.sql | 39 +++++++++++++++++++++++++++- tests/unit/test.php | 19 +++++++++----- 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/tests/unit/mysql-test-initialize.sql b/tests/unit/mysql-test-initialize.sql index a1bc4a4d2..a01128a81 100644 --- a/tests/unit/mysql-test-initialize.sql +++ b/tests/unit/mysql-test-initialize.sql @@ -1,6 +1,22 @@ --- $Id: mysql-test-initialize.sql,v 1.1 2004-11-03 16:55:03 rurban Exp $ +-- $Id: mysql-test-initialize.sql,v 1.2 2004-11-15 16:53:01 rurban Exp $ -- for the regression suite +drop table if exists test_page; +drop table if exists test_version; +drop table if exists test_recent; +drop table if exists test_nonempty; +drop table if exists test_link; +drop table if exists test_session; + +-- since 1.3.7: + +drop table if exists test_pref; +drop table if exists test_user; +drop table if exists test_member; + +drop table if exists test_rating; +drop table if exists test_accesslog; + CREATE TABLE test_page ( id INT NOT NULL AUTO_INCREMENT, pagename VARCHAR(100) BINARY NOT NULL, @@ -86,3 +102,24 @@ CREATE TABLE test_rating ( tstamp TIMESTAMP(14) NOT NULL, PRIMARY KEY (dimension, raterpage, rateepage) ); + +-- only if you need fast log-analysis (spam prevention, recent referrers) +-- see http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/#id2756178 +CREATE TABLE test_accesslog ( + time_stamp int unsigned, + remote_host varchar(50), + remote_user varchar(50), + request_method varchar(10), + request_line varchar(255), + request_args varchar(255), + request_file varchar(255), + request_uri varchar(255), + request_time char(28), + status smallint unsigned, + bytes_sent smallint unsigned, + referer varchar(255), + agent varchar(255), + request_duration float +); +CREATE INDEX log_time ON test_accesslog (time_stamp); +CREATE INDEX log_host ON test_accesslog (remote_host); diff --git a/tests/unit/test.php b/tests/unit/test.php index dd7e95b19..90c944788 100644 --- a/tests/unit/test.php +++ b/tests/unit/test.php @@ -129,6 +129,7 @@ function printMemoryUsage($msg = '') { flush(); } } +/* // now in stdlib.php function printSimpleTrace($bt) { //print_r($bt); echo "Traceback:\n"; @@ -139,6 +140,7 @@ function printSimpleTrace($bt) { print " " . $elem['file'] . ':' . $elem['line'] . "\n"; } } +*/ # Show lots of detail when an assert() in the code fails function assert_callback( $script, $line, $message ) { echo "assert failed: script ", $script," line ", $line," :"; @@ -232,7 +234,9 @@ function printConstant($v) { } else echo "undefined"; echo "\n"; } - +/** + * via the HTML sapi interface print a form to easily change the current cmdline settings. + */ function html_option_form() { global $debug_level,$user_level,$start_debug; @@ -265,9 +269,9 @@ function html_option_form() { $option->pushContent(HTML::input($input), $s, HTML::br()); } } - if ($input) + if (!empty($input)) $form->pushContent(HTML::td($option)); - $table = HTML::form(array('action' => $GLOBALS['PHP_SELF'], + $table = HTML::form(array('action' => $_SERVER['PHP_SELF'], 'method' => 'GET', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('start_debug' => $start_debug)), @@ -302,10 +306,12 @@ $alltests = array('InlineParserTest','HtmlParserTest', 'SetupWiki', 'AllPagesTest','AllUsersTest','OrphanedPagesTest', 'DumpHtml'); +// support db=file db=dba test=SetupWiki test=DumpHtml debug=num -dconstant=value +// or db=file,dba test=SetupWiki,DumpHtml debug=num -dconstant=value if (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) { $argv = array(); foreach ($HTTP_GET_VARS as $key => $val) { - if (is_array($val)) + if (is_array($val)) foreach ($val as $k => $v) $argv[] = $key."=".$k; elseif (strstr($val,",") and in_array($key,array("test","db"))) foreach (explode(",",$val) as $v) $argv[] = $key."=".$v; @@ -315,7 +321,6 @@ if (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) { } elseif (!empty($argv) and preg_match("/test\.php$/", $argv[0])) array_shift($argv); if (!empty($argv)) { - //support db=file db=dba test=SetupWiki test=DumpHtml debug=num -dconstant=value $runtests = array(); $define = array(); $run_database_backends = array(); @@ -343,7 +348,7 @@ if (!empty($argv)) { if (empty($runtests)) $runtests = $alltests; if ($debug_level & 1) { - echo "\n"; + //echo "\n"; echo "PHP_SAPI=",php_sapi_name(), "\n"; echo "PHP_OS=",PHP_OS, "\n"; echo "PHP_VERSION=",PHP_VERSION, "\n"; @@ -388,7 +393,7 @@ require_once 'PHPUnit.php'; ob_end_flush(); if ($debug_level & 1) { - echo "\n"; + //echo "\n"; echo "PHPWIKI_VERSION=",PHPWIKI_VERSION, strstr(PHPWIKI_VERSION,"pre") ? strftime("-%Y%m%d") : "","\n"; if ($debug_level & 9) { // which constants affect memory? -- 2.45.0