【问题标题】:PHPunit how to exclude all files in directory but not exclude subdirectoriesPHPunit如何排除目录中的所有文件但不排除子目录
【发布时间】:2018-01-08 15:59:05
【问题描述】:

我有这样的问题。我想排除 SomeBundle\Entity 中的所有文件,但不想排除 SomeBundle\Entity\Repository 和 SomeBundle\Entity\Factory。

SomeBundle\Entity
SomeBundle\Entity\Repository
SomeBundle\Entity\Factory

SomeBundle\Entity\File1.php
SomeBundle\Entity\File2.php
SomeBundle\Entity\File3.php

我想这样做

    <filter>
        <whitelist>
            <directory>./../src/SomeBundle</directory>
            <exclude>
                <directory suffix=".php">./../src/SomeBundle/Entity</directory>
            </exclude>
        </whitelist>
    </filter>

但结果,我排除了 SomeBundle\Entity 中的所有内容...

【问题讨论】:

    标签: phpunit code-coverage


    【解决方案1】:
    <?xml version="1.0" encoding="UTF-8"?>
    <phpunit colors="true">
        <testsuites>
            <testsuite name="Test Suite">
                <directory>SomeBundle</directory>
                <directory>SomeBundle/Entity/**</directory>
                <exclude>SomeBundle/Entity</exclude>
            </testsuite>
        </testsuites>
    </phpunit>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多