drupol/phingbehattask 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drupol/phingbehattask

Composer 安装命令:

composer require drupol/phingbehattask

包简介

Behat task for Phing.

README 文档

README

Build Status

A Behat task for Phing. This task enable usage of Behat commands in Phing build scripts.

Phing provides tools for usual tasks for PHP projects (phplint, jslint, VCS checkouts, files copy or merge, packaging, upload, etc.). Integration of Behat in Phing is particularly useful when building and testing Drupal projects in a continuous integration server such as Jenkins, Travis or Continuous PHP.

Installation

Installation must be done through Composer:

  composer require drupol/phingbehattask

or by editing your composer.json file and add in the right section:

{
  "require": {
    "drupol/phingbehattask": "dev-master"
  }
}

Usage

Behat task

To use the Behat task in your build file, it must be made available to Phing so that the buildfile parser is aware a correlating XML element and it's parameters.

This is done by adding a <taskdef> task to your build file:

  <taskdef name="behat" classname="\Phing\Behat\Task" />

or by importing the import.xml file:

  <import file="vendor/drupol/phingbehattask/import.xml"/>

Once imported, you are able to use it:

  <behat bin="${project.basedir}/vendor/behat/behat/bin/behat" haltonerror="yes" colors="yes" verbose="${behat.options.verbosity}">
    <option name="config=">${project.basedir}/tests/behat.yml</option> 
  </behat>

See the Phing documentation for more information on the <taskdef> task.

As the Phing Behat Task extends the Phing ExecTask, you are able to use all the options of that command.

Have a look at the ExecTask documentation for the complete list of options.

Behat load balancer task

The Behat load balancer task splits your feature files into an arbitrary number of Behat configuration files.

To use the Behat load balancer task in your build file, it must be made available to Phing so that the buildfile parser is aware a correlating XML element and it's parameters.

This is done by adding a <taskdef> task to your build file:

  <taskdef name="behat:balancer" classname="\Phing\Behat\Balancer" />

or by importing the import.xml file:

  <import file="vendor/drupol/phingbehattask/import.xml"/>

Once imported, you are able to use it as follow:

  <behat:balancer
    containers="5"
    root="/path/to/your/behat/features/directory"
    destination="/path/to/destination/directory"
    import="/path/to/base/behat/configuration/behat.yml"
  />

The attributes have the following meaning:

  • containers: Number of Behat configuration files the feature files will be split into.
  • root: Path to your Behat /features directory.
  • destination: Destination directory in which the new behat files will be generated.
  • import: Main Behat configuration file to be imported in each of the generated file.

You can then configure your continuous integration to run one behat file per environment.

Filtering

The behat balancer also allows for filtering on tags when using multiple profiles.

Filtering matches behat filtering [http://behat.org/en/latest/user_guide/configuration/suites.html#suite-filters]

The following example will first filter the features into profile specific features, by using the tags as a filter:

  • default: NOT @wip AND NOT @profile AND NOT @login AND must contain @theme will only be included and then balanced.
  • secondary_profile: NOT @secondary_profile AND NOT @api AND must contain @secondary_theme or the the text 'As a(n) administrator' will only be included and then balanced. The filters are based on behat's filters and as such will also match any features that contain scenarios that are tagged.
  <behat:balancer
    containers="5"
    root="/path/to/your/behat/features/directory"
    destination="/path/to/destination/directory"
    import="/path/to/base/behat/configuration/behat.yml"
  >
    <filters profile="default">
        <tags><![CDATA[ ~@wip&&~@profile&&~@login&&@theme ]]></tags>
    </filters>
    <filters profile="secondary_profile">
        <tags><![CDATA[ ~@secondary_profile&&~@api&&@secondary_theme ]]></tags>
        <role>administrator</role>
    </filters>
  </behat:balancer>

The balanced files will generate files in the following format behat.{profile}.{part}.yml and will produce the output:

imports:
  - {behat_configuration_file}
{profile}:
  suites:
    default:
      paths:
        - {feature}
        - {feature}

If there are no filters, for backward compatibility the file name is behat.{part}.yml.

drupol/phingbehattask 适用场景与选型建议

drupol/phingbehattask 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 97.84k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 11 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「Behat」 「test」 「ci」 「phing」 「continuous integration」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 drupol/phingbehattask 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 drupol/phingbehattask 我们能提供哪些服务?
定制开发 / 二次开发

基于 drupol/phingbehattask 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 97.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2016-11-15