Skip to content

Fix Monkey Patch - #364

Merged
kenjis merged 12 commits into
masterfrom
fix-monkey-patch
Feb 27, 2021
Merged

Fix Monkey Patch#364
kenjis merged 12 commits into
masterfrom
fix-monkey-patch

Conversation

@kenjis

@kenjis kenjis commented Feb 26, 2021

Copy link
Copy Markdown
Owner
  • add support PHP-Parser 4.6 or later
  • fix bootstrap bug
    • fix bug that determining whether Composer installation or not
  • fix minor bugs

@kenjis
kenjis marked this pull request as draft February 26, 2021 06:29
@coveralls

coveralls commented Feb 26, 2021

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.3%) to 46.217% when pulling 7836e41 on fix-monkey-patch into d9d69ea on master.

@kenjis
kenjis marked this pull request as ready for review February 27, 2021 07:38
@kenjis
kenjis merged commit fc895f2 into master Feb 27, 2021
@kenjis

kenjis commented Feb 27, 2021

Copy link
Copy Markdown
Owner Author

Oops! It seem I ran tests with cached files.
I removed the cache, and run tests:

Warning: Uncaught PhpParser\Error: Syntax error, unexpected T_IF on unknown line in /Users/kenji/work/codeigniter/ci-app-for-ci-phpunit-test/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:317
Stack trace:
#0 /Users/kenji/work/codeigniter/ci-app-for-ci-phpunit-test/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php(158): PhpParser\ParserAbstract->doParse()
#1 /Users/kenji/work/codeigniter/ci-app-for-ci-phpunit-test/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php(51): PhpParser\ParserAbstract->parse('<?php\n\nclass Io...', Object(PhpParser\ErrorHandler\Throwing))
#2 /Users/kenji/work/codeigniter/ci-app-for-ci-phpunit-test/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php(32): PhpParser\Parser\Multiple->tryParse(Object(PhpParser\Parser\Php5), Object(PhpParser\ErrorHandler\Throwing), '<?php\n\nclass Io...')
#3 /Users/kenji/work/codeigniter/ci-app-for-ci-phpunit-test/vendor/kenjis/ci-phpunit-test/application/tests/_ci_phpunit_test/patcher/4.x/Patcher/ConstantPatcher.php(55): PhpParser\Pars in /Users/kenji/work/codeigniter/ci-app-for-ci-phpunit-test/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 317

@kenjis

kenjis commented Feb 27, 2021

Copy link
Copy Markdown
Owner Author
--- a/application/tests/Bootstrap.php
+++ b/application/tests/Bootstrap.php
@@ -315,7 +315,7 @@ MonkeyPatchManager::init([
        'ExitPatcher',
        'FunctionPatcher',
        'MethodPatcher',
-       'ConstantPatcher',
+//     'ConstantPatcher',
    ],
    // Functions to patch
    'functions_to_patch' => [
$ ./test.sh application/tests/controllers/Auth_check_in_construct_test.php 
1) Auth_check_in_construct_test::test_index_not_logged_in
ParseError: syntax error, unexpected 'if' (T_IF)

application/tests/_ci_phpunit_test/tmp/cache/src/application/models/Ion_auth_model.php

    public function set_hook($event, $name, $class, $method, $arguments)
    { if (($__ret__ = \__PatchManager__::getReturn(__CLASS__, __FUNCTION__, func_get_args())) !== __GO_TO_ORIG__) return $__ret__;
        $this->_ion_hooks->{$event}[$name] = new stdClass();
        $this->_ion_hooks->{$event}[$name]->class = $class;
        $this->_ion_hooks->{$event}[$name]->method = $method;
        $this->_ion_hooks->{ if (($__ret__ = \__PatchManager__::getReturn(__CLASS__, __FUNCTION__, func_get_args())) !== __GO_TO_ORIG__) return $__ret__;$event}[$name]->arguments = $arguments;
    }

@kenjis

kenjis commented Feb 27, 2021

Copy link
Copy Markdown
Owner Author

It seems MethodPatcher is still broken.

@kenjis
kenjis deleted the fix-monkey-patch branch February 27, 2021 08:53
kenjis added a commit that referenced this pull request Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants