civicrm/upgrade-test

CiviCRM升级测试的脚本和数据文件集合

0.6 2024-09-20 12:40 UTC

This package is auto-updated.

Last update: 2024-09-20 12:43:49 UTC


README

civicrm-upgrade-test套件提供了一组示例数据库,可用于测试升级逻辑。

范围

为了便于测试多个数据库,当前脚本使用基于命令行的升级器(cv upgrade:db)且从不使用基于Web的UI(civicrm/upgrade)。因此,它适合测试数据库操作。目前它不测试

  • Web UI中的问题(例如浏览器兼容性或CMS页面加载)
  • civicrm.settings.php中的问题
  • PHP、MySQL等设置或兼容性问题

先决条件

  • 拥有Unix-like环境(bash)
  • 安装CiviCRM和cv
  • 在~/.my.cnf中配置MySQL管理员的用户名/密码

设置

## Checkout the repo
cd $HOME
git clone git://github.com/civicrm/civicrm-upgrade-test.git
cd civicrm-upgrade-test
composer install

查找测试案例

## Find snapshots from 5.0.0 through 5.30.0
./bin/civicrm-upgrade-examples @5.0.0..5.30.0

运行测试案例

## Create and edit a settings file
cp examples/civicrm-upgrade-test.settings.txt civicrm-upgrade-test.settings
vi civicrm-upgrade-test.settings
## Note: The file will include comments on the configuration options
## Run the script with a single database
./bin/civicrm-upgrade-test databases/4.2.0-setupsh.sql.bz2

## Run the script with all databases
./bin/civicrm-upgrade-test databases/*.sql.bz2

## Run the script with any databases based on CiviCRM 4.0.x or 4.1.x
./bin/civicrm-upgrade-test databases/{4.0,4.1}*.sql.bz2

执行上述任何命令后,输出将写入civicrm-upgrade-test/output目录。检查这些文件以确定错误。

创建测试案例

要创建新的测试案例,可以将任何CiviCRM数据库导出到文件中——只要CiviCRM数据库与Drupal数据库分开。按照惯例,任何共享的数据库应存储在“databases”目录中,并以前缀CiviCRM版本号开头。例如

mysqldump my_civi_db | bzip2 > databases/4.2.3-my_civi_db.sql.bz2

这并非强制性的。如果您想创建私有测试案例,可以将它们存储在任何位置并遵循自己的命名约定。

独立测试案例

标准测试快照在独立环境中不工作,因为它们不包含独立系统所需的数据库状态。

因此,已在“databases_standalone”目录中创建了一个针对独立特定快照的独立库。当civicrm-upgrade-test在针对独立构建运行时,将自动使用此库。