Enabling Monkey Patching always return error
irwaank opened this issue · 2 comments
irwaank commented
Hi, @kenjis thank you for such a great work :)
I always faced error when I am Enabling Monkey Patching in application/tests/Bootstrap.php. I've already change the PHPUnit version and ci-phpunit-test but still faced a similar error.
PHP Warning: CIPHPUnitTest::init(/home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/replacing/core/Common.php): failed to open stream: "Kenjis\MonkeyPatch\IncludeStream::stream_open" call failed in /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/CIPHPUnitTest.php on line 69
PHP Stack trace:
PHP 1. {main}() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:0
PHP 2. PHPUnit\TextUI\Command::main() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:53
PHP 3. PHPUnit\TextUI\Command->run() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:148
PHP 4. PHPUnit\TextUI\Command->handleArguments() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:159
PHP 5. PHPUnit\TextUI\Command->handleBootstrap() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:788
PHP 6. PHPUnit\Util\Fileloader::checkAndLoad() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:991
PHP 7. PHPUnit\Util\Fileloader::load() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:48
PHP 8. include_once() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:64
PHP 9. CIPHPUnitTest::init() /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/Bootstrap.php:382
Warning: CIPHPUnitTest::init(/home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/replacing/core/Common.php): failed to open stream: "Kenjis\MonkeyPatch\IncludeStream::stream_open" call failed in /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/CIPHPUnitTest.php on line 69
Call Stack:
0.0002 356408 1. {main}() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:0
0.0099 740888 2. PHPUnit\TextUI\Command::main() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:53
0.0099 741000 3. PHPUnit\TextUI\Command->run() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:148
0.0099 741000 4. PHPUnit\TextUI\Command->handleArguments() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:159
0.0180 1051216 5. PHPUnit\TextUI\Command->handleBootstrap() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:788
0.0187 1057400 6. PHPUnit\Util\Fileloader::checkAndLoad() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:991
0.0192 1057704 7. PHPUnit\Util\Fileloader::load() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:48
0.0198 1083120 8. include_once('/home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/Bootstrap.php') /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:64
0.0652 1536032 9. CIPHPUnitTest::init() /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/Bootstrap.php:382
PHP Warning: Uncaught LogicException: Replacement data still remain in /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/Patcher/FunctionPatcher.php:204
Stack trace:
#0 /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/Patcher/AbstractPatcher.php(45): Kenjis\MonkeyPatch\Patcher\FunctionPatcher::generateNewSource('<?php\n/**\n * Pa...')
#1 /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/MonkeyPatchManager.php(326): Kenjis\MonkeyPatch\Patcher\AbstractPatcher->patch('<?php\n/**\n * Pa...')
#2 /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/MonkeyPatchManager.php(289): Kenjis\MonkeyPatch\MonkeyPatchManager::execPatchers('<?php\n/**\n * Pa...')
#3 /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/IncludeStream.php(57): Kenjis\MonkeyPatch\MonkeyPatchManager::patch('/home/vagrant/c...')
#4 /home/vagrant/code/demo/php/ci3_w in /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/Patcher/FunctionPatcher.php on line 204
PHP Stack trace:
PHP 1. {main}() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:0
PHP 2. PHPUnit\TextUI\Command::main() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:53
PHP 3. PHPUnit\TextUI\Command->run() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:148
PHP 4. PHPUnit\TextUI\Command->handleArguments() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:159
PHP 5. PHPUnit\TextUI\Command->handleBootstrap() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:788
PHP 6. PHPUnit\Util\Fileloader::checkAndLoad() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:991
PHP 7. PHPUnit\Util\Fileloader::load() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:48
PHP 8. include_once() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:64
PHP 9. CIPHPUnitTest::init() /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/Bootstrap.php:382
Warning: Uncaught LogicException: Replacement data still remain in /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/Patcher/FunctionPatcher.php:204
Stack trace:
#0 /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/Patcher/AbstractPatcher.php(45): Kenjis\MonkeyPatch\Patcher\FunctionPatcher::generateNewSource('<?php\n/**\n * Pa...')
#1 /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/MonkeyPatchManager.php(326): Kenjis\MonkeyPatch\Patcher\AbstractPatcher->patch('<?php\n/**\n * Pa...')
#2 /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/MonkeyPatchManager.php(289): Kenjis\MonkeyPatch\MonkeyPatchManager::execPatchers('<?php\n/**\n * Pa...')
#3 /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/IncludeStream.php(57): Kenjis\MonkeyPatch\MonkeyPatchManager::patch('/home/vagrant/c...')
#4 /home/vagrant/code/demo/php/ci3_w in /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/patcher/3.x/Patcher/FunctionPatcher.php on line 204
Call Stack:
0.0002 356408 1. {main}() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:0
0.0099 740888 2. PHPUnit\TextUI\Command::main() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:53
0.0099 741000 3. PHPUnit\TextUI\Command->run() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:148
0.0099 741000 4. PHPUnit\TextUI\Command->handleArguments() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:159
0.0180 1051216 5. PHPUnit\TextUI\Command->handleBootstrap() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:788
0.0187 1057400 6. PHPUnit\Util\Fileloader::checkAndLoad() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:991
0.0192 1057704 7. PHPUnit\Util\Fileloader::load() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:48
0.0198 1083120 8. include_once('/home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/Bootstrap.php') /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:64
0.0652 1536032 9. CIPHPUnitTest::init() /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/Bootstrap.php:382
PHP Fatal error: CIPHPUnitTest::init(): Failed opening required '/home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/replacing/core/Common.php' (include_path='.:/usr/share/php') in /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/CIPHPUnitTest.php on line 69
PHP Stack trace:
PHP 1. {main}() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:0
PHP 2. PHPUnit\TextUI\Command::main() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:53
PHP 3. PHPUnit\TextUI\Command->run() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:148
PHP 4. PHPUnit\TextUI\Command->handleArguments() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:159
PHP 5. PHPUnit\TextUI\Command->handleBootstrap() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:788
PHP 6. PHPUnit\Util\Fileloader::checkAndLoad() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:991
PHP 7. PHPUnit\Util\Fileloader::load() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:48
PHP 8. include_once() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:64
PHP 9. CIPHPUnitTest::init() /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/Bootstrap.php:382
Fatal error: CIPHPUnitTest::init(): Failed opening required '/home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/replacing/core/Common.php' (include_path='.:/usr/share/php') in /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/_ci_phpunit_test/CIPHPUnitTest.php on line 69
Call Stack:
0.0002 356408 1. {main}() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:0
0.0099 740888 2. PHPUnit\TextUI\Command::main() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/phpunit:53
0.0099 741000 3. PHPUnit\TextUI\Command->run() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:148
0.0099 741000 4. PHPUnit\TextUI\Command->handleArguments() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:159
0.0180 1051216 5. PHPUnit\TextUI\Command->handleBootstrap() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:788
0.0187 1057400 6. PHPUnit\Util\Fileloader::checkAndLoad() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/TextUI/Command.php:991
0.0192 1057704 7. PHPUnit\Util\Fileloader::load() /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:48
0.0198 1083120 8. include_once('/home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/Bootstrap.php') /home/vagrant/code/demo/php/ci3_with_phpunit/vendor/phpunit/phpunit/src/Util/Fileloader.php:64
0.0652 1536032 9. CIPHPUnitTest::init() /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/Bootstrap.php:382
This is my environment:
- PHP: 7.0.33
- Codeigniter: 3.1.11
- PHPUnit: ^6.5
- ci-phpunit-test: dev-master ** I've already used V.0.18.0 and V.0.17.0
If I disabled the monkey patch, everything working awesome:
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.
Runtime: PHP 7.0.33-27+ubuntu18.04.1+deb.sury.org+1 with Xdebug 2.8.1
Configuration: /home/vagrant/code/demo/php/ci3_with_phpunit/application/tests/phpunit.xml
... 3 / 3 (100%)
Time: 1.84 seconds, Memory: 6.00MB
OK (3 tests, 3 assertions)
Generating code coverage report in Clover XML format ... done
Generating code coverage report in HTML format ... done
Please help, now I am stuck on that error :'(
Thank You