Skip to content

phpunit don't work (fatal error) on PHP 7.0.0 #373

Closed
@takekoshinet

Description

@takekoshinet

Due to recent changes, phpunit don't work (fatal error) on PHP 7.0.0.
On 7.0.14, it works.

I can't find differences between both of them, but root cause is that test-code eats application namespace.
/tests/_support/Services.php's namespace is \CodeIgniter\Services. This namespace is too rich for test-code.

It is avoidable by using PHP latest version, but probably it will appear on latest version someday.
I will use 7.0.14 for a while. Now I want to make queue.
FYI.

$ phpenv local 7.0.14

$ phpunit

==== Redirecting to composer installed version in vendor/phpunit ====

PHPUnit 5.3.5 by Sebastian Bergmann and contributors.

.............................................................   61 / 1213 (  5%)
.............................................................  122 / 1213 ( 10%)
.............................................................  183 / 1213 ( 15%)
.............................................................  244 / 1213 ( 20%)
.............................................................  305 / 1213 ( 25%)
.............................................................  366 / 1213 ( 30%)
.............................................................  427 / 1213 ( 35%)
.............................................................  488 / 1213 ( 40%)
.............................................................  549 / 1213 ( 45%)
.............................................................  610 / 1213 ( 50%)
.............................................................  671 / 1213 ( 55%)
.............................................................  732 / 1213 ( 60%)
.............................................................  793 / 1213 ( 65%)
.............................................................  854 / 1213 ( 70%)
.............................................................  915 / 1213 ( 75%)
.............................................................  976 / 1213 ( 80%)
............................................................. 1037 / 1213 ( 85%)
............................................................. 1098 / 1213 ( 90%)
............................................................. 1159 / 1213 ( 95%)
......................................................        1213 / 1213 (100%)

Time: 1.26 minutes, Memory: 44.00MB

OK (1213 tests, 1925 assertions)

Generating code coverage report in Clover XML format ... done
$ phpenv local 7.0.0

$ phpunit

==== Redirecting to composer installed version in vendor/phpunit ====


$ tail -n12 /var/log/php_errors.7.0.0.log 
PHP Fatal error:  Cannot use Config\Services as Services because the name is already in use in /path/to/project/system/CodeIgniter.php on line 4
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:49
PHP   3. PHPUnit_TextUI_Command->run() /path/to/project/vendor/phpunit/phpunit/src/TextUI/Command.php:110
PHP   4. PHPUnit_TextUI_Command->handleArguments() /path/to/project/vendor/phpunit/phpunit/src/TextUI/Command.php:121
PHP   5. PHPUnit_TextUI_Command->handleBootstrap() /path/to/project/vendor/phpunit/phpunit/src/TextUI/Command.php:683
PHP   6. PHPUnit_Util_Fileloader::checkAndLoad() /path/to/project/vendor/phpunit/phpunit/src/TextUI/Command.php:854
PHP   7. PHPUnit_Util_Fileloader::load() /path/to/project/vendor/phpunit/phpunit/src/Util/Fileloader.php:38
PHP   8. include_once() /path/to/project/vendor/phpunit/phpunit/src/Util/Fileloader.php:56
PHP   9. spl_autoload_call() /path/to/project/tests/_support/_bootstrap.php:95
PHP  10. CodeIgniter\Autoloader\Autoloader->CodeIgniter\Autoloader\{closure}() /path/to/project/tests/_support/_bootstrap.php:95

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions