PHPackages                             provision-ops/yaml-tests - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. provision-ops/yaml-tests

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

provision-ops/yaml-tests
========================

Plugin to run commands from a YML file and pass to GitHub commit status API.

1.13.1(6y ago)56.0k↓24.2%1[5 PRs](https://github.com/provision-ops/yaml-tests/pulls)MITPHPCI failing

Since May 23Pushed 5y agoCompare

[ Source](https://github.com/provision-ops/yaml-tests)[ Packagist](https://packagist.org/packages/provision-ops/yaml-tests)[ RSS](/packages/provision-ops-yaml-tests/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (7)Versions (44)Used By (0)

Yaml Tests
==========

[](#yaml-tests)

Yaml Tests is a simple composer plugin tthat make it as simple as possible to define and run a set of tests.

The plugin provides a composer command that simply reads a YML file and runs the lines as a process.

The output is rendered in a way to be easier to read, and proper exit code returns if a single process fails.

It can be installed "locally" (included in your composer.json file) or "globally" (installed into the global "composer" command.

Installation
------------

[](#installation)

Keeping `yaml-tests` in your `composer.json` (local install) is the most stable way to operate, since the version is pinned.

### Local Install

[](#local-install)

1. `cd my-composer-project`
2. `composer require provision-ops/yaml-tests`

### Global Install

[](#global-install)

`composer global require provision-ops/yaml-tests`

To confirm the command is installed, ask for help:

```
composer yaml-tests --help
```

GitHub Integration
------------------

[](#github-integration)

If you pass `yaml-tests` a GitHub Token, it will send the test results as "commit status" indicators.

There are 3 ways to pass the GitHub Token to YamlTests:

1. Use the `--github-token` command line option. Don't use this in CI, or you might expose your GitHub token in logs.
2. Set a GITHUB\_TOKEN environment variable. This is pretty simple in Docker, but can be a challenge if your tests get run in different environments.
3. **Recommended:** Create a `.env` file in your repo, or in your user's home directory:

    ```
    GITHUB_TOKEN=abcdefg

    ```

    There is a `.env.example` file in this directory you can use as an example.

Writing Tests
-------------

[](#writing-tests)

### Create tests.yml file

[](#create-testsyml-file)

By default the `composer yaml-tests` command looks for a tests.yml file in the project root. You can also pass a path using the `--tests-file` option.

The `tests.yml` file is read as a simple collection of commands. The key can be any string, as long as it is unique in the test suite.

```
test/dir: pwd
test/environment: env
```

You can also include commands in a list:

```
lint:
  - find src -name '*.php' -print0 | xargs -0 -n1 php -l
  - find web/modules/custom -name '*.php' -print0 | xargs -0 -n1 php -l
  - find tests/src -name '*.php' -print0 | xargs -0 -n1 php -l
```

You can include a description for each test like:

```
debug:
  command: env
  description: Current Environment
```

### Commands in tests.yml

[](#commands-in-testsyml)

Yaml Tests work like [Composer Scripts](https://getcomposer.org/doc/articles/scripts.md#writing-custom-commands): If your project has the `config.bin-dir` set in `composer.json`, Composer will automatically add that directory to the PATH when scripts or other commands are run.

For example, you can include PHPUnit and call it without specifying the full path in composer scripts or `tests.yml`

`composer.json`:

```
{
    "config": {
        "bin-dir": "bin/"
    },
    "require": {
        "provision-ops/yaml-tests": "^1.1",
        "phpunit/phpunit": "^8.1"
    },
    "scripts": {
        "test": [
            "which phpunit",
            "phpunit --version"
        ]
    }
}
```

Having the `scripts.test` section in `composer.json` creates a composer command called `composer test`.

`tests.yml`:

```
test/debug:
  - which phpunit
  - phpunit --version
```

If you want to only maintain one set of scripts, you can reference composer scripts in `tests.yml`:

`tests.yml`:

```
test/debug: composer test
```

Running tests
-------------

[](#running-tests)

Once the `tests.yml` file is in place, and the `composer yaml-tests` command is available, you can trigger test runs.

### Dry Runs vs Normal

[](#dry-runs-vs-normal)

This plugin was also designed to pass these tests as "Commit Statuses" on GitHub. This allows us to tag the results to the specific commit, pass or fail.

If the environment variable `GITHUB_TOKEN` or the command line option `--github-token` is NOT set, the `--dry-run` option will be forced.

Use the `--dry-run` option if you have a token set but do not want to post test results to GitHub.

Run `composer yaml-tests` or, just like all composer commands, you can use shortcuts like `compose y`.

```
composer yaml-tests
```

The output will look something like this:

[![Test Run](https://github.com/provision-ops/yaml-tests/raw/master/assets/test-run.png?raw=true)](https://github.com/provision-ops/yaml-tests/blob/master/assets/test-run.png?raw=true)

And you will get a nice summary at the end like this:

[![Test Run](https://github.com/provision-ops/yaml-tests/raw/master/assets/test-result.png?raw=true)](https://github.com/provision-ops/yaml-tests/blob/master/assets/test-result.png?raw=true)

Yaml-Tests executable
---------------------

[](#yaml-tests-executable)

There is now a "bin" for yaml-tests, allowing the command to be run by itself.

If you require provision-ops/yaml-tests, you will see a link to `yaml-tests` in your `bin-dir`.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Total

32

Last Release

2252d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/10539fb9e887c35b626eba70c97dd9d53ba14e987d4f129b55a488664a834eca?d=identicon)[jonpugh](/maintainers/jonpugh)

---

Top Contributors

[![jonpugh](https://avatars.githubusercontent.com/u/106420?v=4)](https://github.com/jonpugh "jonpugh (233 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/provision-ops-yaml-tests/health.svg)

```
[![Health](https://phpackages.com/badges/provision-ops-yaml-tests/health.svg)](https://phpackages.com/packages/provision-ops-yaml-tests)
```

###  Alternatives

[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)[drupal/core-project-message

Adds a message after Composer installation.

2122.6M172](/packages/drupal-core-project-message)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[vaimo/composer-changelogs

Provide information about package changes based on changelog files that are bundled with releases; provide tools for generating documentation files from changelog sources

11150.5k10](/packages/vaimo-composer-changelogs)[uma/composer-psysh

No-frills PsySH-Composer plugin

183.2k](/packages/uma-composer-psysh)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
