peridot-php/peridot-yo-plugin

"YO! 测试运行完成后找到合适的人"

1.1.0 2014-10-22 02:17 UTC

This package is not auto-updated.

Last update: 2024-09-20 21:44:08 UTC


README

Build Status

当测试通过或失败时,通过全球最简单的消息服务 Yo 通知合适的人

这是 PHP 事件驱动测试框架 Peridot 的插件

用法

我们建议通过 composer 将此插件添加到您的项目中

$ composer require --dev peridot-php/peridot-yo-plugin:~1.0

通过您的 peridot.php 文件轻松使用此插件

<?php
use Evenement\EventEmitterInterface;
use Peridot\Plugin\Yo\YoPlugin;

return function (EventEmitterInterface $emitter) {
    /**
     * Register by passing the peridot event emitter,
     * a yo api token obtained from http://dev.justyo.co/,
     * an an array of users to be Yo'ed,
     * and an optional string or function that returns a link string
     */
    $plugin = YoPlugin::register($emitter, "your-yo-token", ['USER1', 'USER2'], 'http://linktobuild.com');
};

行为

此插件有一些行为,您可以根据需要配置何时接收 Yo 通知。这些行为都存在于 YoPlugin 类的常量中,并且可以像这样传递给插件

<?php
use Evenement\EventEmitterInterface;
use Peridot\Plugin\Yo\YoPlugin;

return function (EventEmitterInterface $emitter) {
    $plugin = YoPlugin::register($emitter, "your-yo-token", ['USER1', 'USER2'], 'http://linktobuild.com');
    $plugin->setBehavior(YoPlugin::BEHAVIOR_ON_PASS);
};

BEHAVIOR_ON_PASS

当测试套件通过时接收 Yo 通知。

BEHAVIOR_ON_FAIL

当测试套件失败时接收 Yo 通知。这是默认行为。

BEHAVIOR_ALWAYS

当测试套件运行完成后接收 Yo 通知。

运行测试

测试是用 Peridot 编写的。您可以像这样运行它们

$ vendor/bin/peridot specs/

贡献

当然欢迎拉取请求、问题和反馈。