torotil/upal

PHPUnit 与 Drupal 集成

2.0.0-RC2 2020-12-10 18:49 UTC

This package is auto-updated.

Last update: 2024-09-11 03:06:38 UTC


README

一组用于帮助在 Drupal 中使用 PHPUnit 运行测试的类。

upal 假设测试可以修改数据库。

用法

配置

默认情况下,配置是从 UPAL_* 环境变量中读取的。如果您觉得这样可以,只需要确保 upal 的类是可自动加载的。

配置可以从数组或文件(YAML、XML 等)中加载。upal 使用此配置库:https://github.com/hassankhan/config

示例 bootstrap.php

$config = new Upal\Config();
$config->set('drush', '/path/to/drush');
$config->set('drupal_root', '/path/to/drupal/root');
Upal\DrupalBootstrap::$config = $config;

默认配置

  • drush: UPAL_DRUSH, trim(which drush)
  • root: UPAL_ROOT, realpath('.')
  • web_url: UPAL_WEB_URL, 'http://upal'
  • tmp: UPAL_TMP, sys_get_temp_dir()