Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported PHPT --SECTION-- throws unhandled exception #3011

Closed
nacc opened this issue Feb 14, 2018 · 8 comments
Closed

Unsupported PHPT --SECTION-- throws unhandled exception #3011

nacc opened this issue Feb 14, 2018 · 8 comments

Comments

@nacc
Copy link

@nacc nacc commented Feb 14, 2018

I apologize for not being super familiar with the code, but both Ubuntu and Debian are hitting fatal DEP8 tests due to:

throw new Exception(

In the prior PHPUnit, 5.4.6, we saw:

PHPUnit 5.4.6 by Sebastian Bergmann and contributors.

PHPUnit does not support this PHPT file

but now we get:

PHPUnit 6.5.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.2-1ubuntu1
Configuration: /tmp/autopkgtest.hQ7Ome/build.rU8/src/Cache_Lite-1.7.16/phpunit.xml.dist

PHP Fatal error:  Uncaught PHPUnit\Runner\Exception: PHPUnit does not support this PHPT file in /usr/share/php/PHPUnit/Runner/PhptTestCase.php:349
Stack trace:
#0 /usr/share/php/PHPUnit/Runner/PhptTestCase.php(149): PHPUnit\Runner\PhptTestCase->parse()
#1 /usr/share/php/PHPUnit/Framework/TestSuite.php(755): PHPUnit\Runner\PhptTestCase->run(Object(PHPUnit\Framework\TestResult))
#2 /usr/share/php/PHPUnit/TextUI/TestRunner.php(546): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#3 /usr/share/php/PHPUnit/TextUI/Command.php(195): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#4 /usr/share/php/PHPUnit/TextUI/Command.php(148): PHPUnit\TextUI\Command->run(Array, true)
#5 /usr/bin/phpunit(34): PHPUnit\TextUI\Command::main()
#6 {main}
  thrown in /usr/share/php/PHPUnit/Runner/PhptTestCase.php on line 349

Which causes the package self-tests to fail (this is for php-cache-lite). My understanding is that this is internal to PHPUnit, and not expected to be handled by the caller, right?

@sebastianbergmann
Copy link
Owner

@sebastianbergmann sebastianbergmann commented Feb 15, 2018

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

Loading

@sebastianbergmann
Copy link
Owner

@sebastianbergmann sebastianbergmann commented Apr 7, 2018

No feedback, closing.

Loading

@arjendekorte
Copy link

@arjendekorte arjendekorte commented Feb 13, 2019

I'd like to reopen this. This can be reproduced in the following PEAR module:

https://github.com/pear/Console_CommandLine/archive/v1.2.2.tar.gz

Unpack archive, enter Console_CommandLine-1.2.2 directory and place following phpunit.xml in that directory:

<testsuites>
    <testsuite name="PHPT Test Suite">
        <directory suffix=".phpt">tests</directory>
    </testsuite>
</testsuites>

Run phpunit. Boom.

PHP Fatal error:  Uncaught PHPUnit\Runner\Exception: PHPUnit does not support this PHPT file in phar:///usr/bin/phpunit/phpunit/Runner/PhptTestCase.php:405
Stack trace:
#0 phar:///usr/bin/phpunit/phpunit/Runner/PhptTestCase.php(112): PHPUnit\Runner\PhptTestCase->parse()
#1 phar:///usr/bin/phpunit/phpunit/Framework/TestSuite.php(746): PHPUnit\Runner\PhptTestCase->run(Object(PHPUnit\Framework\TestResult))
#2 phar:///usr/bin/phpunit/phpunit/Framework/TestSuite.php(746): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#3 phar:///usr/bin/phpunit/phpunit/TextUI/TestRunner.php(641): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#4 phar:///usr/bin/phpunit/phpunit/TextUI/Command.php(206): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#5 phar:///usr/bin/phpunit/phpunit/TextUI/Command.php(162): PHPUnit\TextUI\Command->run(Array, true)
#6 /usr/bin/phpunit(614): PHPUnit\TextUI\Command::main()
#7 {main}
thrown in phar:///usr/bin/phpunit/phpunit/Runner/PhptTestCase.php on line 405

It would be helpful if the PHPT file was mentioned that caused this, to narrow down what can be done to prevent this.

Loading

@arjendekorte
Copy link

@arjendekorte arjendekorte commented Feb 13, 2019

That was with PHPUnit 7.5.3 by the way.

Loading

@epdenouden epdenouden self-assigned this Feb 13, 2019
@epdenouden
Copy link
Collaborator

@epdenouden epdenouden commented Feb 13, 2019

@arjendekorte @nacc

I am able to reproduce the bug with:

wget https://github.com/pear/Console_CommandLine/archive/v1.2.2.tar.gz
tar zxvf v1.2.2.tar.gz
cd Console_CommandLine-1.2.2
composer install
./vendor/bin/phpunit --color=always --testdox tests
  • bug is verified to exist
  • Console_CommandLine uses PHPUnit 8.x already by default

image

but something else is going on, which I will look into:

 ✔ /Users/ewout/proj/Console_CommandLine-1.2.2/tests/console_commandline_parse_9.phpt
PHP Fatal error:  Uncaught PHPUnit\Runner\Exception: PHPUnit does not support this PHPT file in /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/Runner/PhptTestCase.php:440
Stack trace:
#0 /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/Runner/PhptTestCase.php(114): PHPUnit\Runner\PhptTestCase->parse()
#1 /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/Framework/TestSuite.php(761): PHPUnit\Runner\PhptTestCase->run(Object(PHPUnit\Framework\TestResult))
#2 /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(632): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#3 /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/TextUI/Command.php(208): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#4 /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/TextUI/Command.php(164): PHPUnit\TextUI\Command->run(Array, true)
#5 /Users/ewout/proj/Co in /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/Runner/PhptTestCase.php on line 440

Fatal error: Uncaught PHPUnit\Runner\Exception: PHPUnit does not support this PHPT file in /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/Runner/PhptTestCase.php on line 440

PHPUnit\Runner\Exception: PHPUnit does not support this PHPT file in /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/Runner/PhptTestCase.php on line 440

Call Stack:
    0.0006     398296   1. {main}() /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/phpunit:0
    0.0046     797024   2. PHPUnit\TextUI\Command::main() /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/phpunit:61
    0.0046     797136   3. PHPUnit\TextUI\Command->run() /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/TextUI/Command.php:164
    0.0184    1672608   4. PHPUnit\TextUI\TestRunner->doRun() /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/TextUI/Command.php:208
    0.0277    2128368   5. PHPUnit\Framework\TestSuite->run() /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:632
    4.5377    4249816   6. PHPUnit\Runner\PhptTestCase->run() /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/Framework/TestSuite.php:761
    4.5377    4249816   7. PHPUnit\Runner\PhptTestCase->parse() /Users/ewout/proj/Console_CommandLine-1.2.2/vendor/phpunit/phpunit/src/Runner/PhptTestCase.php:114

after which PHPUnit will just quit to command line.

Loading

@epdenouden epdenouden reopened this Feb 13, 2019
@epdenouden epdenouden changed the title PHPUnit unsupported PHPT file gets bubbled up Unsupported PHPT --SECTION-- throws unhandled exception Feb 13, 2019
@epdenouden
Copy link
Collaborator

@epdenouden epdenouden commented Feb 13, 2019

@nacc @arjendekorte The problem is the --GET-- section in the PHPT-file. I can offer you no suggestion why this has not come up before, most likely exception handling has changed either by code or by environment settings.

To do:

  • fix for PHPUnit 7 to convert unhandled exception into properly skipped test
  • explore work required to bring new code location hints from v8 to v7

Loading

@arjendekorte
Copy link

@arjendekorte arjendekorte commented Feb 13, 2019

  • fix for PHPUnit 7 to convert unhandled exception into properly skipped test

That would solve it for me.

  • explore work required to bring new code location hints from v8 to v7

I'm not sure if that's worth the effort. I can switch to v8 easily for development, as long as the bug is fixed in v7 as well.

Loading

@epdenouden
Copy link
Collaborator

@epdenouden epdenouden commented Feb 14, 2019

@arjendekorte Bringing the improved code hints to v7 is not a problem. The infrastructure is already there. If anything, it shows me getting used to contributing to a large project that has two major releases existing side-by-side.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants