sugared-rim/phpunit

PHPUnit sweetened with ease

7.0.0 2018-03-18 18:33 UTC

This package is not auto-updated.

Last update: 2022-01-22 05:11:51 UTC


README

SensioLabsInsight

PHPUnit sweetened with ease 🍒

SugaredRim\PHPUnit takes an opinionated view of testing with PHPUnit, it is preconfigured to get you up and running as quickly as possible.

Install

$ composer require --dev sugared-rim/phpunit

Usage

Instead of requiring and running phpunit use sugared-rim-phpunit - that's it, no phpunit.xml* needed:

{
    ...
    "require-dev": {
        "sugared-rim/phpunit": ...
    },
    "scripts": {
        "test": "sugared-rim-phpunit"
    }
}

Configuration

You may overwrite some options by putting it in your composer.json.

Some of the default settings:

{
    ...
    "scripts": {
        "test": "sugared-rim-phpunit"
    },
    "extra": {
        "sugared-rim/phpunit": {
            "bootstrap": "vendor/autoload.php",
            "coverage": {
                "text": "php://stdout",
                "clover": "build/logs/clover.xml",
                "html": "build/coverage-phpunit/"
            },
            "src": "src",
            "tests": "tests",
            "colors": true,
            "sugared": {
                "listeners": [
                ]
            }
        }
    }
}

src

The source directory.

tests

The tests directory.

coverage

See Command-Line Options for details.

Example: Add SpeedTrapListener

$ composer require --dev johnkary/phpunit-speedtrap
{
    ...
    "extra": {
        "sugared-rim/phpunit": {
            "sugared": {
                "listeners": [
                    {
                        "class": "JohnKary\\PHPUnit\\Listener\\SpeedTrapListener",
                        "arguments": [{"slowThreshold": 500, "reportLength": 10}]
                    }
                ]
            }
        }
    }
}

License

MIT © Michael Mayer