peridot-php/peridot-yo-plugin

"YO! The right people when a test run finishes"

1.1.0 2014-10-22 02:17 UTC

This package is not auto-updated.

Last update: 2024-04-05 19:41:26 UTC


README

Build Status

Notify the right people when tests pass or fail, via the world's simplest messaging service Yo

This is a plugin for PHP's event driven testing framework Peridot

Usage

We recommend adding this plugin to your project via composer:

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

Using the plugin is easy via your peridot.php file:

<?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');
};

Behaviors

This plugin has a few behaviors so you can configure when you want to receive Yo notifications. These all exist as constants on the YoPlugin class, and can be passed to the plugin like so:

<?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

Receive Yo notifications when the test suite passes.

BEHAVIOR_ON_FAIL

Receive Yo notifications when the test suite fails. This is the default behavior.

BEHAVIOR_ALWAYS

Receive Yo notifications when the test suite finishes running.

Running tests

Tests were written using Peridot. You can run them like so:

$ vendor/bin/peridot specs/

Contributing

Pull requests, issues, and feedback are of course always welcome.