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

Overview

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.

You might also like...
The Phoronix Test Suite is the most comprehensive testing and benchmarking platform
The Phoronix Test Suite is the most comprehensive testing and benchmarking platform

The Phoronix Test Suite is the most comprehensive testing and benchmarking platform available for Linux, Solaris, macOS, Windows, and BSD operating systems.

Prevent none-test output in your Pest tests.
Prevent none-test output in your Pest tests.

Pest Plugin Silence Often, when writing tests, we echo and dump test code to debug and check everything is working correctly. It can be easy to forget

Test requests in Laravel without all the boilerplate.

Request Factories Test requests in Laravel without all the boilerplate. 💡 Psst. Although our examples use Pest PHP, this works just as well in PHPUni

To run time/IO related unit tests (e.g., sleep function calls, database queries, API calls, etc) faster using Swoole.

To run time/IO related unit tests (e.g., sleep function calls, database queries, API calls, etc) faster using Swoole.

A tool to run migrations prior to running tests

cakephp-test-migrator A tool to run migrations prior to running tests The Migrator For CakePHP 3.x composer require --dev vierge-noire/cakephp-test-mi

A PHP Module, that help with geneting of task script for playwright and send it node.js

A PHP Module, that help with geneting of task script for playwright and send it node.js

PHP client for Selenium/WebDriver protocol. Previously facebook/php-webdriver

Php-webdriver library is PHP language binding for Selenium WebDriver, which allows you to control web browsers from PHP.

The modern, simple and intuitive PHP unit testing framework.

atoum PHP version atoum version 5.3 - 5.6 1.x - 3.x 7.2 - 8.x 4.x (current) A simple, modern and intuitive unit testing framework for PHP! Just lik

Full-stack testing PHP framework

Codeception Modern PHP Testing for everyone Codeception is a modern full-stack testing framework for PHP. Inspired by BDD, it provides an absolutely n

Releases(v1.0.0)
Owner
Raphael Stolt
Raphael Stolt
Event driven BDD test framework for PHP

The highly extensible, highly enjoyable, PHP testing framework. Read more at peridot-php.github.io or head over to the wiki. Building PHAR Peridot's p

Peridot 327 Jan 5, 2023
BDD test framework for PHP

BDD test framework for PHP, inspired by Jasmine and RSpec. Features a familiar syntax, and a watch command to automatically re-run specs during develo

Daniel St. Jules 286 Nov 12, 2022
PHP Test Generator - A CLI tool which generates unit tests

This project make usages of PHPStan and PHPParser to generate test cases for a given PHP File.

Alexander Schranz 7 Dec 3, 2022
vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest.

vfsStream vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with

null 1.4k Dec 23, 2022
⛽ Pest plugin to test Laravel applications powered by Octane.

⛽ Laravel Octane (Pest Plugin) Pest plugin to test Laravel applications powered by Octane. Install Via Composer composer require --dev cerbero/pest-pl

Andrea Marco Sartori 21 Apr 5, 2022
Magic Test allows you to write browser tests by simply clicking around on the application being tested, all without the slowness of constantly restarting the testing environment.

Magic Test for Laravel Magic Test allows you to write browser tests by simply clicking around on the application being tested, all without the slownes

null 400 Jan 5, 2023
A sample RESTful API in Laravel with PHPunit test.

Laravel PHP Framework URL | URI | Action |

Fasil 9 Jul 11, 2020
PHPUnit Application Architecture Test

PHPUnit Application Architecture Test Idea: write architecture tests as well as feature and unit tests Installation Install via composer composer requ

null 19 Dec 11, 2022
Patchstack Test task Laravel&Vue CRUD

Patchstack Test Task - Laravel & Vue CRUD SPA Written with Laravel and Vue2 using mix. Installation Clone this repository Run "composer update" comman

Crypto Rookie 3 Aug 25, 2022