GithubHelp home page GithubHelp logo

raphaelstolt / composer-multitest Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 0.0 28 KB

A Composer script to run a 'test' or 'spec' Composer script against multiple PHP versions.

License: MIT License

Shell 0.17% PHP 99.83%
composer-scripts phpunit phpspec repository-utilities phpbrew phpenv

composer-multitest's Introduction

composer-multitest

Build Status Version PHP Version composer.lock available

composer-multitest is a Composer script that runs a test or spec Composer script against multiple PHP versions managed by PHPBrew or phpenv. Kind of a local Travis CI.

Assumptions

As composer-multitest utilizes phpenv and PHPBrew it's assumed that at least one of them is installed and manages several PHP versions. It will first look for phpenv managed versions and when this fails it will subsequently look for PHPBrew managed ones.

The versions to test against are read from the local Travis CI configuration so it's assumed that one is present. Versions present in the Travis CI configuration not having a phpenv or PHPBrew managed version will fail the script when not disabled via the --skip-missing-versions option.

The Composer script composer-multitest will run MUST be named test or spec and it can be defined in a Composer script namespace like library:test|spec.

Installation

The Composer script should be installed as a development dependency through Composer.

composer require --dev stolt/composer-multitest

Usage

Once installed add the Composer script to the existing composer.json and use it afterwards via composer multitest.

{
    "scripts": {
        "multitest": "Stolt\\Composer\\Multitest::run"
    },
}

If you want to disable the prerequisite that the tests or specs have to be run against all PHP versions defined in the Travis CI configuration use the --skip-missing-versions option like shown next.

{
    "scripts": {
        "multitest-run": "Stolt\\Composer\\Multitest::run",
        "multitest": "composer run-script multitest-run -- --skip-missing-versions"
    },

Example output

The follow console output shows an example multitest run against two PHP versions.

❯ composer multitest
> Stolt\Composer\Multitest::run
>> Switching to 'php-7.0.4'.
>> Running 'composer lpv:test'.
PHPUnit 5.6.1 by Sebastian Bergmann and contributors.

................................................................. 65 / 96 ( 67%)
...............................                                   96 / 96 (100%)

Time: 591 ms, Memory: 12.25MB

OK (96 tests, 150 assertions)

>> Switching to 'php-5.6.19'.
>> Running 'composer lpv:test'.
PHPUnit 5.6.1 by Sebastian Bergmann and contributors.

................................................................. 65 / 96 ( 67%)
...............................                                   96 / 96 (100%)

Time: 591 ms, Memory: 12.25MB

OK (96 tests, 150 assertions)

❯ echo $?
0
❯

Running tests

composer cm:test

License

This Composer script is licensed under the MIT license. Please see LICENSE for more details.

Changelog

Please see CHANGELOG for more details.

Contributing

Please see CONTRIBUTING for more details.

composer-multitest's People

Contributors

raphaelstolt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

composer-multitest's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.