2017-07-27 10 views
0

私のphpunit.xmlの設定をカスタムテストスイートで定義しようとしています。カスタムテストスイートでは、すべてのユニットテストを目的のフォルダに再帰的に読み込みます。再帰的なディレクトリ式を持つPHPUnitロードテストスイート

フォルダのパスの例:

tests/path/Unit/MyTest.php 
tests/path/path/Unit/MyTest.php 
tests/path/path/path/Unit/MyTest.php 
tests/path/path/path/path/Unit/MyTest.php 
... 
tests/{.../}/Unit/MyTest.php 

私はこのような私のスイートを定義することができます。

<testsuites> 
    <testsuite name="Project Unit Test Suite"> 
     <directory>tests/*/Unit</directory> 
     <directory>tests/*/*/Unit</directory> 
     <directory>tests/*/*/*/Unit</directory> 
     <directory>tests/*/*/*/*/Unit</directory> 
     ... 
    </testsuite> 
</testsuites> 

を私の式は、単一の行になり、すべてのサブフォルダを反復処理する方法はあります?

+0

私の知る限り、あなたはすべてのサブディレクトリを言及する必要はありません。 ' tests' – akond

+0

@akond私は除外したい(機能的)いくつかのテストがあります:) – Aistis

+0

なぜ ''を使用しないのですか? – akond

答えて

0

この場合、**を使用します。私は、ディレクトリの名前を異なるサブディレクトリの中に入れようとしているので、**はどこでも動作します。

<?xml version="1.0"?> 
<phpunit colors="true" backupGlobals="false"> 
    <testsuites> 
    <testsuite name="Test Suite"> 
     <directory>tests</directory> 
     <exclude>**/Functional</exclude> 
    </testsuite> 
    </testsuites> 
</phpunit> 

かではなく、物事を含めたい場合:

<?xml version="1.0"?> 
<phpunit colors="true" backupGlobals="false"> 
    <testsuites> 
    <testsuite name="Test Suite"> 
     <directory>**/Unit</directory> 
     <exclude>*</exclude> 
    </testsuite> 
    </testsuites> 
</phpunit> 
関連する問題