diff options
| author | Damien Regad <dregad@mantisbt.org> | 2020-01-15 01:01:36 +0100 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2020-01-24 23:08:41 +0100 |
| commit | 25d30e4dea91ae5005b4434dea23f572a54fd30c (patch) | |
| tree | 1578d42104cfad3e2433136a0496640fbc51fcee /tests | |
| parent | fd33e16493213abaadd0be79841ca02f02070030 (diff) | |
| download | adodb-25d30e4dea91ae5005b4434dea23f572a54fd30c.tar.gz adodb-25d30e4dea91ae5005b4434dea23f572a54fd30c.tar.bz2 adodb-25d30e4dea91ae5005b4434dea23f572a54fd30c.zip | |
Remove PHP version checks from test scripts
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-active-record.php | 5 | ||||
| -rw-r--r-- | tests/test.php | 29 | ||||
| -rw-r--r-- | tests/test4.php | 11 | ||||
| -rw-r--r-- | tests/testdatabases.inc.php | 35 |
4 files changed, 31 insertions, 49 deletions
diff --git a/tests/test-active-record.php b/tests/test-active-record.php index 59471620..8fb02caa 100644 --- a/tests/test-active-record.php +++ b/tests/test-active-record.php @@ -5,10 +5,7 @@ // uncomment the following if you want to test exceptions if (@$_GET['except']) { - if (PHP_VERSION >= 5) { - include('../adodb-exceptions.inc.php'); - echo "<h3>Exceptions included</h3>"; - } + include('../adodb-exceptions.inc.php'); } $db = NewADOConnection('mysql://root@localhost/northwind?persist'); diff --git a/tests/test.php b/tests/test.php index 9ffe6a82..177233b6 100644 --- a/tests/test.php +++ b/tests/test.php @@ -28,7 +28,6 @@ function getmicrotime() } -if (PHP_VERSION < 5) include_once('../adodb-pear.inc.php'); //-------------------------------------------------------------------------------------- //define('ADODB_ASSOC_CASE',1); // @@ -1346,11 +1345,6 @@ END Adodb; $rs = $db->SelectLimit('select id,firstname,lastname,created,\'The "young man", he said\' from ADOXYZ',10); - if (PHP_VERSION < 5) { - print "<pre>"; - rs2tabout($rs); - print "</pre>"; - } #print " CacheFlush "; #$db->CacheFlush(); @@ -1645,16 +1639,21 @@ END Adodb; print "<p>Testing Bad Connection</p>"; flush(); - if (true || PHP_VERSION < 5) { - if ($db->dataProvider == 'odbtp') $db->databaseType = 'odbtp'; - $conn = NewADOConnection($db->databaseType); - $conn->raiseErrorFn = 'adodb_test_err'; - if (1) $conn->PConnect('abc','baduser','badpassword'); - if ($TESTERRS == 2) print "raiseErrorFn tests passed<br>"; - else print "<b>raiseErrorFn tests failed ($TESTERRS)</b><br>"; - - flush(); + if ($db->dataProvider == 'odbtp') { + $db->databaseType = 'odbtp'; + } + $conn = NewADOConnection($db->databaseType); + $conn->raiseErrorFn = 'adodb_test_err'; + $conn->PConnect('abc','baduser','badpassword'); + if ($TESTERRS == 2) { + print "raiseErrorFn tests passed<br>"; + } + else { + print "<b>raiseErrorFn tests failed ($TESTERRS)</b><br>"; } + + flush(); + //////////////////////////////////////////////////////////////////// global $nocountrecs; diff --git a/tests/test4.php b/tests/test4.php index e825b18f..02da4833 100644 --- a/tests/test4.php +++ b/tests/test4.php @@ -45,12 +45,11 @@ $conn->PConnect("localhost", "root", "", "test"); // connect to MySQL, testdb #$conn = ADONewConnection('oci8po'); #$conn->Connect('','scott','natsoft'); -if (PHP_VERSION >= 5) { - $connstr = "mysql:dbname=northwind"; - $u = 'root';$p=''; - $conn = ADONewConnection('pdo'); - $conn->Connect($connstr, $u, $p); -} +$connstr = "mysql:dbname=northwind"; +$u = 'root';$p=''; +$conn = ADONewConnection('pdo'); +$conn->Connect($connstr, $u, $p); + //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; diff --git a/tests/testdatabases.inc.php b/tests/testdatabases.inc.php index a35781ef..f73b8fe4 100644 --- a/tests/testdatabases.inc.php +++ b/tests/testdatabases.inc.php @@ -275,8 +275,7 @@ if (!empty($testvfp)) { // ODBC if (!empty($testmysql)) { // MYSQL - if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; - else $server = "mangrove"; + $server = 'localhost'; $user = 'root'; $password = ''; $database = 'northwind'; $db = ADONewConnection("mysqlt://$user:$password@$server/$database?persist"); print "<h1>Connecting $db->databaseType...</h1>"; @@ -294,8 +293,7 @@ if (!empty($testmysqli)) { // MYSQL $db = ADONewConnection('mysqli'); print "<h1>Connecting $db->databaseType...</h1>"; - if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; - else $server = "mangrove"; + $server = 'localhost'; if ($db->PConnect($server, "root", "", "northwind")) { //$db->debug=1;$db->Execute('drop table ADOXYZ'); testdb($db, @@ -310,8 +308,7 @@ if (!empty($testmysqlodbc)) { // MYSQL $db = ADONewConnection('odbc'); $db->hasTransactions = false; print "<h1>Connecting $db->databaseType...</h1>"; - if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; - else $server = "mangrove"; + $server = 'localhost'; if ($db->PConnect('mysql', "root", "")) testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); @@ -321,7 +318,7 @@ if (!empty($testmysqlodbc)) { // MYSQL if (!empty($testproxy)){ $db = ADONewConnection('proxy'); print "<h1>Connecting $db->databaseType...</h1>"; - if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; + $server = 'localhost'; if ($db->PConnect('http://localhost/php/phplens/adodb/server.php')) testdb($db, @@ -358,25 +355,15 @@ if (false && !empty($testoracle)) { ADOLoadCode("odbc_db2"); // no longer supported if (!empty($testdb2)) { - if (PHP_VERSION>=5.1) { - $db = ADONewConnection("db2"); - print "<h1>Connecting $db->databaseType...</h1>"; + $db = ADONewConnection("db2"); + print "<h1>Connecting $db->databaseType...</h1>"; - #$db->curMode = SQL_CUR_USE_ODBC; - #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest"; - if ($db->Connect('localhost','natsoft','guest','test')) { - testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); - } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg(); + #$db->curMode = SQL_CUR_USE_ODBC; + #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest"; + if ($db->Connect('localhost','natsoft','guest','test')) { + testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); } else { - $db = ADONewConnection("odbc_db2"); - print "<h1>Connecting $db->databaseType...</h1>"; - - $dsn = "db2test"; - #$db->curMode = SQL_CUR_USE_ODBC; - #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest"; - if ($db->Connect($dsn)) { - testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); - } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg(); + print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg(); } echo "<hr />"; flush(); |
