Skip to content

1.0.2 fails with phpunit <7 when installed with "--from-composer" #411

Description

@tenzap

I think there is a small issue in 1.0.2 when using phpunit 5 or 6. With phpunit7 there is no problem.
version 1.0.2 is the last one supporting php 5.6

The cause is the presence of <exclude>./_ci_phpunit_test/</exclude> in phpunit.xml

If there is this line and if we installed with --from-composer , phpunit will fail with the error below.

This is because the dir application/tests/_ci_phpunit_test/ doesn't exist in that case. Probably it is more of a phpunit bug, but I'm not sure this would ever be fixed there.

Error:

An uncaught Exception was encountered

Type:        ErrorException
Message:     strpos(): Empty needle
Filename:    vendor/phpunit/php-file-iterator/src/Iterator.php
Line Number: 104

Backtrace:
        File: vendor/phpunit/php-file-iterator/src/Iterator.php
        Line: 104
        Function: strpos

        File: vendor/phpunit/php-file-iterator/src/Iterator.php
        Line: 91
        Function: acceptPath

        File: vendor/phpunit/php-file-iterator/src/Factory.php
        Line: 58
        Function: append

        File: vendor/phpunit/php-file-iterator/src/Facade.php
        Line: 37
        Function: getFileIterator

        File: vendor/phpunit/phpunit/src/Util/Configuration.php
        Line: 941
        Function: getFilesAsArray

        File: vendor/phpunit/phpunit/src/Util/Configuration.php
        Line: 843
        Function: getTestSuite

        File: vendor/phpunit/phpunit/src/TextUI/Command.php
        Line: 784
        Function: getTestSuiteConfiguration

        File: vendor/phpunit/phpunit/src/TextUI/Command.php
        Line: 127
        Function: handleArguments

        File: vendor/phpunit/phpunit/src/TextUI/Command.php
        Line: 116
        Function: run

        File: phpvfscomposer://vendor/phpunit/phpunit/phpunit
        Line: 51
        Function: main

        File: vendor/bin/phpunit
        Line: 118
        Function: include

Workaround is:

  • to create the dir, but that's not a good solution, such an empty dir wouldn't appear in git (unless putting an empty file in it)
  • or not put the <exclude>./_ci_phpunit_test/</exclude> line in phpunit.xml when installed with '--from-composer'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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