enlitepro/enlite-behat-extension

Behat 扩展,用于集成 Zend Framework 2 应用程序

v1.0.0 2013-10-15 16:05 UTC

This package is not auto-updated.

Last update: 2024-09-24 01:54:26 UTC


README

为 Zend Framework 2 提供集成层

  • 集成到 Zend Framework 模块结构中 - 您可以通过名称、类名甚至完整路径运行独立的模块套件

  • ApplicationAwareInterface,为您的上下文提供已启动的应用程序

  • Zend\ServiceManager\ServiceLocatorAwareInterface,为您的上下文提供服务定位器

安装

将以下内容添加到您的 composer.json

{
    "require": {
        "enlitepro/enlite-behat-extension": "1.0.*"
    }
}

并在您的 behat.yml 中添加

default:
  extensions:
    EnliteBehatExtension\Zf2Extension: ~
      # module: moduleName
      # config: path_to_application.config.php
      # environment: testing

用法

# create directory structure and context file in module Application
behat --init "@Application"

# You can use short module notation to run features
behat "@Application"

您可以为您的上下文实现两个接口

  1. EnliteBehatExtension\Context\ApplicationAwareInterface - 注入 Zend\Mvc\Application。您可以使用 trait EnliteBehatExtension\Context\ApplicationAwareTrait 来实现所需的方法

  2. Zend\ServiceManager\ServiceLocatorAwareInterface - 注入服务管理器

致谢

灵感来源于 Symfony2Extension