Skip to content

<exclude> behaves relative sometimes #928

Closed
@JeroenDeDauw

Description

@JeroenDeDauw

(PHPUnit 3.7.19)

I have a phpunit.xml.dist file containing the following:

    <testsuite name="ValueParsers">
        <directory>/ValueParsers/tests</directory>
        <exclude>/ValueParsers/tests/includes/api</exclude>
    </testsuite>

This now works fine, however what I had before was

    <testsuite name="ValueParsers">
        <directory>ValueParsers/tests</directory>
        <exclude>ValueParsers/tests/includes/api</exclude>
    </testsuite>

(Note the lack of leading slashes.)

This worked when running phpunit in the directory where the file is itself. When running it elsewhere and specifying the config file using --config, the exclude would however stop working.

This is strange behaviour as all other paths in this file, such as the one to my bootstrap file, or the ones, are behaving correctly regardless.

What makes it even more odd is that adding a leading slash to just the section of my test suite will fix the problem with its behaving relative as well.

    <testsuite name="ValueParsers">
        <directory>/ValueParsers/tests</directory>
        <exclude>ValueParsers/tests/includes/api</exclude>
    </testsuite>

So I'm guessing this is either a bug. Or paths not starting with a slash are simply not officially supported, and most of them are just working by chance.

Upgraded to 3.7.21 and still seeing the issue. Though now it seems adding leading slashes does no longer work around the behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions