drunomics / behat-drupal-utils
提供使用Behat与Drupal配合的步骤定义、上下文和实用工具。
2.10.3
2023-04-06 08:09 UTC
Requires
- drupal/drupal-extension: ^4.1.0 || ^5.0.0
Replaces
This package is auto-updated.
Last update: 2024-09-06 11:00:39 UTC
README
依赖
- Behat
- Drupal
- Drupal 扩展
- 启用Javascript的Behat驱动程序(例如
dmore/behat-chrome-extension
)
所有javascript步骤定义都使用 dmore/behat-chrome-extension
进行了测试。
概述
该包提供
-
各种有用的Behat上下文,组织成以下上下文类
- DrupalUtilsApiContext
- DrupalUtilsDrushContext
- MinkUtilsContext
- HttpHeadersContext
根据您的Behat配置,应添加适合的上下文类。它会自动包含所有兼容的步骤定义。
-
可选的附加上下文类,提供自动检查或清理程序,例如
- DrupalCleanTestContentApiContext
- DrupalErrorCheckApiContext
烟雾测试
下面的 ./examples/ 中的测试确保简单的Drupal登录/登出工作,并且可以打开您网站的一个页面,同时加载前端资源,不会触发javascript或watchdog错误。
设置
- 将此包添加到项目的开发依赖中。
- 将以下三个上下文之一添加到您的 behat.yml 中,可选地也可以添加可选上下文。
- 请随意复制示例 Behat 功能。
- 将提供的js文件添加到您的网站js中。监听器是必需的,以捕获js错误。
检测watchdog错误
默认行为
当添加 DrupalErrorCheckApiContext 时,除了 Notice
、Info
和 Debug
以外的所有 watchdog 条目都将被检测,并在 behat PHP 运行器中自动触发PHP错误。
调整watchdog条目严重性到 NOTICE
级别
要将错误检测严重性更改为 NOTICE
,请将 behat.yml 中的 fail_on_notice
参数设置为 TRUE
。
contexts:
- drunomics\BehatDrupalUtils\Context\DrupalErrorCheckApiContext:
fail_on_notice: TRUE
鸣谢
由 drunomics GmbH 开发,hello@drunomics.com 请参阅提交日志以了解个人贡献者。