elbformat/symfony-behat-bundle

为 symfony 应用程序预定义的可扩展 behat 环境。

安装次数: 6,457

依赖者: 2

建议者: 0

安全性: 0

星星: 0

关注者: 2

分支: 2

公开问题: 11

类型:symfony-bundle


README

本扩展包为 symfony 应用程序提供可重用的 behat 环境。所有步骤均以现在时态编写,如https://automationpanda.com/2021/05/11/should-gherkin-steps-use-past-present-or-future-tense/所述。

功能

安装

将 composer 需求作为开发依赖项添加。

$ composer require --dev elbformat/symfony-behat-bundle

在您的 config/bundles.php 中激活扩展包。

Elbformat\SymfonyBehatBundle\ElbformatSymfonyBehatBundle::class => ['test' => true],

根据需要使用 behat.yml 中的环境。

default:
  extensions:
    FriendsOfBehat\SymfonyExtension:
      bootstrap: tests/bootstrap.php
      kernel:
        path: src/Kernel.php
        class: App\Kernel
        environment: behat
        debug: false
  suites:
    default:
      contexts:
        - Elbformat\SymfonyBehatBundle\Context\CommandContext
        - Elbformat\SymfonyBehatBundle\Context\DateContext
        - Elbformat\SymfonyBehatBundle\Context\FormContext
        - Elbformat\SymfonyBehatBundle\Context\HtmlContext
        - Elbformat\SymfonyBehatBundle\Context\HttpContext
        - Elbformat\SymfonyBehatBundle\Context\JsonContext
        - Elbformat\SymfonyBehatBundle\Context\LoggingContext
        - Elbformat\SymfonyBehatBundle\Context\MailerContext

邮件

要使 Test-Mailer 正常工作,您需要在 config/packages/mailer.yaml 中设置邮件发送者 dsn。

when@test:
    framework:
        mailer:
            dsn: 'test://test'

API

要避免向真实 API 发送请求,您应配置 config/packages/framework.yaml 中使用的 MockClient。

when@test:
    framework:
        http_client:
            mock_response_factory: Elbformat\SymfonyBehatBundle\HttpClient\MockClientCallback

示例

示例可以在 dock/examples.md 中找到。

更新

当从先前版本更新时,请查看 changelog 了解更改。

接下来是什么?

下一个版本可能包含更多测试/稳定性改进。

开发

如果您想开发该扩展包,您将在 doc/development.md 中找到有用的信息。