How to configure PHPUnit for Apigility ZF2 application with multiple versions?

phpunit.xml

for a common ZF2 application with a common folder structure

...
/phpunit
/phpunit/phpunit.xml
/module
/module/Application
/module/ModuleFoo
/module/ModuleBar
...

      

can be defined as follows:

<phpunit>
    <testsuites>
        <testsuite name="modules">
            <directory>../modules/Application/tests</directory>
            <directory>../modules/ModuleFoo/tests</directory>
            <directory>../modules/ModuleBar/tests</directory>
        </testsuite>
    </testsuites>
</phpunit>

      

I am now writing an Apigility based REST API application that will have multiple versions in the future.

...
/phpunit
/phpunit/phpunit.xml
/module
/module/Application
/module/ModuleBuzApi
/module/ModuleBuzApi/V1
/module/ModuleBuzApi/V2
...
/module/ModuleBuzApi/Vn
...

      

I can define a test suite for each version, but then I have to copy and paste it for each new version. Is there a more elegant approach?

+3


source to share


1 answer


Maybe just use a wildcard?

For example:



<testsuites>
    <testsuite name="modules">
        <directory>../modules/*/tests</directory>
    </testsuite>
</testsuites>

      

0


source







All Articles