Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running all PHPUnit tests for a project using Composer

I have a set of PHP projects, some of which depend on others. All have PHPUnit tests. All are installable via Composer, and specify their dependencies using a composer.json file. Each project has a phpunit.xml.dist file in their root, which points to a bootsrap file.

Now I have this project Foo that has a number of direct dependencies and several indirect ones. For the CI of Foo, I'd like to run all its tests, and all those of its dependencies.

Is this somehow possible to do via Composer? If not, is there some standard-ish clean way of doing this?

like image 354
Jeroen De Dauw Avatar asked Oct 05 '13 16:10

Jeroen De Dauw


People also ask

How do I run a composer test?

Download and run Composer-Setup.exe. It will install the latest Composer version and set up your PATH so that you can call composer from any directory in your command line. Note: Close your current terminal. Test usage with a new terminal: This is important since the PATH only gets loaded when the terminal starts.

What is PHPUnit testing?

PHPUnit is a unit testing framework for the PHP programming language. It is an instance of the xUnit architecture for unit testing frameworks that originated with SUnit and became popular with JUnit. PHPUnit was created by Sebastian Bergmann and its development is hosted on GitHub.


1 Answers

You could try composer scripts

{
    "scripts": {
        "test": "phpunit"
    }
}

Or maybe create a makefile and then call that using composer

{
    "scripts": {
        "build-all": "make build-all"
    }
}
like image 199
Daithí Avatar answered Oct 01 '22 00:10

Daithí