ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


project:unittests

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

project:unittests [2025/07/21 01:31] – created mnewnhamproject:unittests [2025/07/21 03:36] (current) mnewnham
Line 1: Line 1:
 ====== Unit Testing ====== ====== Unit Testing ======
 +<WRAP warning>This feature is in initial development. Feature may change substantially at any time</WRAP>
 Unit testing can be done using PHPUnit testing. Testing can be done against any database that is available that you have admin rights on. The test creates tables, populates them with small amounts of data and drops them. Unit testing can be done using PHPUnit testing. Testing can be done against any database that is available that you have admin rights on. The test creates tables, populates them with small amounts of data and drops them.
  
 +===== Setup ==== 
 +Configuration information for the tests is held in a configuration file adodb-unittest.ini. The file can be located anywhere in the PHP include path. The configuration is based on the driver name.
 +
 +<code>
 +[mysqli]
 +dsn=
 +host=mysql-server.com
 +user=root
 +password=somepassword
 +database=adodb-tester
 +debug=0
 +parameters=
 +</code>
 +
 +^Setting^Description^
 +|dsn|Either use a connection DSN or specify the parameters usual|
 +|host|The hostname associated with the database|
 +|user|The connection username|
 +|password|The connection password|
 +|debug|Sets the debug mode|
 +|parameters|To set parameters normally set by ''setConnectionParameter()'', create a string in format **key=value;** Note that the parameters cannot be defined as constants, you must use the numeric or string equivalents| 
 +
 +===== Test Execution ===== 
 +
 +<code>
 +phpunit unittest --bootstrap unittest/dbconnector.php <driver>
 +</code>
 +
 +Where the <driver> name represents the ADOdb driver to use. For use of PDO drivers use the format pdo-<driver>. The driver name **__must__** follow the bootstrap file name
 +
 + 
  
  
project/unittests.txt · Last modified: by mnewnham