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

Both sides previous revisionPrevious revision
Next revision
Previous revision
project:unittests [2025/08/03 03:36] – [PHPUnit] mnewnhamproject:unittests [2025/09/07 22:55] (current) mnewnham
Line 4: Line 4:
  
 ===== Prerequistes =====   ===== Prerequistes =====  
-[[https://phpunit.de|PHPUnit]] Version 9 or higher must be installed to conduct the suite of tests.+  * PHP 8.0 or higher 
 +  * [[https://phpunit.de|PHPUnit]] Version 9 or higher must be installed to conduct the suite of tests. 
  
 ===== Setup ===== ===== 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.  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. 
  
-===== Settup Up The Configuration File ===== +===== Setting Up The Configuration File ===== 
 ==== ADOdb Section ==== ==== ADOdb Section ====
-If the ADOdb section is defined, and the item directory is set, the tests can be run against any ADOdb installation set locally. This is useful if ADOdb is embedded into a different application+Add the ADOdb section and set the item directory The tests will be run against the ADOdb installation in that directory
  
 <code> <code>
 [ADOdb] [ADOdb]
 directory=/opt/some/local/ADOdb/installation directory=/opt/some/local/ADOdb/installation
-</code> 
- 
-If the section is not defined, it assumes that the ADOdb installation is the parent directory of the unit test 
- 
-<code> 
-/opt/ADOdb 
-/opt/ADOdb/unittest 
 </code> </code>
  
Line 73: Line 67:
  
 ==== Caching Section ==== ==== Caching Section ====
-Unless explicitly enabled, cache functions such as //**CacheExecute()**// are skipped. Tests only currently support Filesystem based caching. To activate this, add the following section to adodb-unittest.ini: +Unless explicitly enabled, cache functions such as //**CacheExecute()**// are skipped. Tests are supported using Filesystem based or memcache based caching. To activate this, add the following section to adodb-unittest.ini: 
 +=== Filesystem === 
 <code> <code>
 [caching] [caching]
 cacheMethod=1 cacheMethod=1
 cacheDir=c:/dev/cache cacheDir=c:/dev/cache
 +</code>
 +
 +=== Memcache Based === 
 +<code>
 +[cache]
 +cacheMethod=2
 +cacheHost=192.168.1.50
 </code> </code>
  
Line 108: Line 109:
 It is not possible to pass the driver name as a run-time argument in this version. The driver to test must have the **active** flag defined in the driver section. It is not possible to pass the driver name as a run-time argument in this version. The driver to test must have the **active** flag defined in the driver section.
  
 +===== Writing or Updating Tests ===== 
  
- +  * Tests should be compliant with PHPunit version 9 and higher 
 +  * Tests should be compatible with all platforms supported by PHPunit 
 +  * Tests should be written to [[https://www.php-fig.org/psr/psr-12/|PSR 12]] standards when possible 
 +  * Wherever possible, write database agnostic tests. Only write driver specific tests when a feature is only supported by one or two DBMS 
 +  * Only add driver specific tests to the test file specifically labeled for that driver, e.g. //**MysqliDriverTest.php**// 
 +  * Do not add driver-based code branches inside the generic test code
    
  
  
project/unittests.1754184985.txt.gz · Last modified: by mnewnham