php - How to configure PHPUnit to test the whole vendor folder in a ZF2 application? -


i'm developing zend framework 2 application common folder structure, folder /vendor contains (project external) libraries. setting unit testing environment able run vendor tests. folders structures different depending on library. packages have no tests @ all.

a possible solution create test suite "vendor" , manually define there paths every single test folder, e.g.:

phpunit.xml

<?xml version="1.0" encoding="utf-8"?> <phpunit ...>     <testsuites>         <testsuite name="vendor">             <directory>../vendor/lib-foo/path/to/tests</directory>             <directory>../vendor/package-bar/path/to/tests</directory>             ...         </testsuite>         ...     </testsuites>     ... </phpunit> 

i don't solution. first of because i'd have handle every package manually.

another solution define /vendor test folder:

phpunit.xml

<?xml version="1.0" encoding="utf-8"?> <phpunit ...>     <testsuites>         <testsuite name="vendor">             <directory>../vendor</directory>             ...         </testsuite>         ...     </testsuites>     ... </phpunit> 

well, phpunit has scan lot of folders, doesn't need, , tests need more time.

is there better solution, make possible automate process , avoid manual configuration?

it difficult run phpunit vendor test suites single test run. 1 issue each of different test suites might ship own configuration file or require custom bootstrap configuration file. cannot cover when running test suites single command.

i'd use shell magic this. note example relies on presence of phpunit.xml(.dist) file in each of 3rd party packages (for libraries that's reasonable assumption). integrate continuous integration process test continuously:

for file in $(find . -name 'phpunit.xml*') ;     sh -c 'cd '$(dirname $file)' && composer install'     vendor/bin/phpunit -c $file done 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -