kenjis/ci-phpunit-test

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

tenzap opened this issue · 2 comments

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'

Thank you for reporting.

But unfortunately install.php is not perfect. See #373
I recommend you remove the line in phpunit.xml manually.

Also, CI3 is almost no longer maintained. I don't recommend to use.

Thanks.

Also, CI3 is almost no longer maintained. I don't recommend to use.

Sad outcome for open-source projects in maintenance mode with low manpower. Hopefully minimal maintenance will still be provided.