mnewnham/adodb-unittest
Composer 安装命令:
composer create-project mnewnham/adodb-unittest
包简介
A PHPUnit testing package for ADOdb
README 文档
README
This is a standalone PHPUnit Unit Tester for the ADOdb database abstraction layer. It runs using any supported ADOdb database and performs tests against the driver and data dictionary for the database in use. It can be easily configured to run against multiple, side-by-side installations of ADOdb. For that reason, ADOdb is not included in the composer file. It can be found at Github or at Packagist
Installation
Easiest installed from Packagist as this will add PHPUnit as well, otherwise download the release code and use it
Prerequsites
PHPunit version 12+ must be installed and running for this to work. Packagist will install it if you don't already have it. An ADOdb installation must be installed somewhere on the local file system, but that doesn't need any special installation.
- The unit tester requires access to a supported database via a configured ADOdb connection. The user requires privileges to add, change and delete tables, views and procedures as well as SELECT,CREATE,UPDATE,DELETE privileges on the created tables.
- To test the filesystem caching, write permission on the local filesystem is required
- To test memcache caching, access to a configured memcache server is required
Current Coverage
| Core | Data Dictionary |
Meta Functions |
Caching | Active Record |
XmlSchema | Session Management |
Stored Procedures |
Driver Specific Tests |
||
|---|---|---|---|---|---|---|---|---|---|---|
| mysqli | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |||
| mssqlnative | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ||||
| sqlite3 | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ||||
| postgres9 | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |||
| oci8 | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |||
| db2 | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |||
| PDO | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
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. A template file with sample settings is available in /tools/samples
Setting Up The Configuration File
ADOdb Section
Add the ADOdb section and set the base directory for the ADOdb installation to test. If an ADOdb installation is included in the composer file, then that installation will effectively capture the test paths and only that installation can be tested.
Setting the casing activates the ADODB_CASE value Setting the forcemode activates the ADODB_FORCE_MODE value
[ADOdb]
directory=/opt/some/local/ADOdb/installation
;0 ADODB_ASSOC_CASE_LOWER
;1 ADODB_ASSOC_CASE_UPPER
;2 ADODB_ASSOC_CASE_NATIVE
casing=1;
;ADODB_FORCE_IGNORE',0
;ADODB_FORCE_NULL',1
;ADODB_FORCE_EMPTY',2
;ADODB_FORCE_VALUE',3
;ADODB_FORCE_NULL_AND_ZERO',4
forcemode=0;
Driver Section
Each database to test requires an entry. The entry name can be anything, the connection type is based on the driver entry in the section. You can add as many drivers to the configuration file as you want. The first driver found in the configuration file flagged active is tested.
[MySQL]
driver=mysqli
dsn=
host=mysql-server.com
user=root
password=somepassword
database=adodb-tester
debug=0
parameters=
active=1
| 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 Driver constants, you must use the numeric or string equivalents |
| active | The test is run against the first driver where the active flag is set to true |
Blob Section
This section must be defined with the path names of 2 files:
- A binary file to test BLOB handling, such as a jpeg file that can be used for read-write testing. If you use a very large size file, it may measurably slow down the test. If set to false or the file name is invalid, all BLOB tests are skipped.
- A Plain text file to test CLOB handling. If set to false or the file name is invalid, all CLOB tests are skipped
[blob]
testBlob=c:/temp/someJpeg.jpg
testClob=c:/temp/someBigTextFile.txt
XMLschema Section
This section must be explicitly enabled in the configuration file, with the skipXmlTests value set to 0, otherwise all tests in the section are skipped. Setting the value to 1 will also skip the tests. Setting debug=1 in this section activates the extended debugging feature available in this module.
[xmlschema]
skipXmlTests=0
debug=0
Meta Section
Unless explicitly enabled, the test to create a new database using the createDatabase method is skipped as it requires CREATE DATABASE privilege on the DBMS. To enable this test, set the following section:
[meta]
skipDbCreation=0
Active Record System
[activerecord]
skipTests=0
extended=0
quotefieldnames=false|UPPER|LOWER|BRACKETS
To test active-recordx.inc.php, set the extended flag to 1
Caching Section
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 Based Tests
[caching]
cacheMethod=1
cacheDir=c:/dev/cache
Memcache Based Tests
[cache]
cacheMethod=2
cacheHost=192.168.1.50
To disable cache tests while leaving the section in place, ''set cacheMethod=0''
Stored Procedures
Stored procedure testing must be explicitly enabled by adding a section and setting a parameter
[storedprocedures]
skipTests=0
Sessions Section
This section provides testing for the ADOdb session management system and requires access to a functioning webserver enabled for PHP
skipTests=0;
url=http://localhost/unittest
verbose=0
persist=P
compress=
encrypt=
clob=
- The url parameter points to a virtual directory that references ADOdb-Unittest/server
- verbose activates additionally debugging options. Note that these will generate warnings in the PHPUnit test
- persist (options: P - Persist, N - New Connection, C - Connect)
- compress (options: gzip, bz2)
- encrypt (options: crypt, sha1) [secret only testable on linux]
- clob (options: null, CLOB, BLOB) matches the type of sessdata column
Testing compression or encryption options requires use of a session schema file where the sessdata column is a BLOB storage field
Transactions Section
The tests ensure that a transaction has completed successfully if initiated. If this fails, the errors generated may obscure following errors. Set temporarily to expose those errors.
[transactions]
ignoreScopeErrors=1;
Globals Section
To test some date functions, the local timezone must be equal to the server timezone. To change the timezone temporarily for the test, set the following global parameter in adodb-unittest.ini. This should exactly match the format in php.ini.
[globals]
date.timezone = 'America/Denver'
Any parameter saved into the [globals] section will be set using ini_set()
Test Execution
Testing supports all of the standard PHPunit test methods. Every test must include the --bootstrap connection statement
Examples
Complete System
Approximately 80 tests with 1500 assertions
phpunit /install-directory/ADOdb-unittest/src --bootstrap=/install-directory/ADOdb-unittest/tools/dbconnector.php
Testing just the data dictionary functions
phpunit src/DataDict --bootstrap=tools/dbconnector.php
Testing a single function
phpunit src/Helpers/GetInsertSqlTest.php --bootstrap=tools/dbconnector.php
Driver Specific Tests
If an ADOdb feature is not supported by all systems, e.g. MySQL bulk binding, the test is located in /Drivers directory
mnewnham/adodb-unittest 适用场景与选型建议
mnewnham/adodb-unittest 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mnewnham/adodb-unittest 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mnewnham/adodb-unittest 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-13