lundi 4 mai 2015

Composer and automated unit tests

I am using composer in my own / company projects for deployment, etc. I already use php unit tests, but now I also would like to add automated unit testing whenever the project is installed or updated, i.e., I would like to execute phpunit on the composer pre-autoload-dump event. See http://ift.tt/1rBa7fN

Depending on the success of the unit tests, I would like to either continue or stop the installation process of my package. So if a unit test fails, the version should not be installed.

How would you suggest in general to proceed on this intention?

My composer.json looks like this:

{
    "name": "Cravid/event",
    "require": {
        "php": ">=5.3.0",
        "phpunit/phpunit": "4.*"
    },
    "autoload": {
        "psr-4": {"Cravid\\Event\\": "src/Gkm/Event"}
    },
    "autoload-dev": {
        "psr-4": {"Cravid\\Event\\": "tests/Gkm/Event"}
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.0.x-dev"
        }
    },
    "scripts": {
        "pre-autoload-dump": "phpunit"
    }
}

Git is the designated version control system.

Aucun commentaire:

Enregistrer un commentaire