GithubHelp home page GithubHelp logo

Cannot test Fatal errors about tester HOT 12 CLOSED

nette avatar nette commented on May 18, 2024
Cannot test Fatal errors

from tester.

Comments (12)

fprochazka avatar fprochazka commented on May 18, 2024

@assertCode doesn't work? https://github.com/nette/nette/blob/master/tests/Nette/Diagnostics/Debugger.E_ERROR.production.phpt#L8

from tester.

milo avatar milo commented on May 18, 2024

Oh, I forgot to run it by php-cgi. Thank you, I get it.
EDIT: Deleted unnecessary part in issue message.

from tester.

dg avatar dg commented on May 18, 2024

Good point. In fact, the problem is bigger, because we have no assurance that Debugger::$onFatalError was called. We have, die(0);

from tester.

dg avatar dg commented on May 18, 2024

Ok, I have removed exit() from this 4ebc7a0#L0R42 and added @ExitCode 75a2fe8

from tester.

milo avatar milo commented on May 18, 2024

@dg 👍 But error message from Helpers::setup() still polute the stdoout. What about this solution? milo@c9168c6

from tester.

milo avatar milo commented on May 18, 2024

The idea is: shutdown function from Helpers::setup() is the first one. On fatal error, is called as first and appends next shutdown function on the queue end.

from tester.

dg avatar dg commented on May 18, 2024

This will work only if no other shutdown function will call die(). And Debugger calls die() https://github.com/nette/nette/blob/master/Nette/Diagnostics/Debugger.php#L470.

from tester.

milo avatar milo commented on May 18, 2024

Debugger expects fatal error and test generates one for this purpose. Exit code is fine. I was thinking, that Helpers::setup()'s handler should catch and inform about unexpected fatal error.

from tester.

dg avatar dg commented on May 18, 2024

Yes, I agree. Merged 5d77edc

from tester.

dg avatar dg commented on May 18, 2024

Fuck… https://bugs.php.net/bug.php?id=65275

from tester.

milo avatar milo commented on May 18, 2024

Heh, that is what I commented out in this issue topic message. I was thinking that it is some kind of CLI speciality.

And really nice bug numbers 😄

from tester.

milo avatar milo commented on May 18, 2024

It looks like as some kind of "protection". Only zero code (program success) can be overwritten, any other is kept, so shutdown function cannot chage it to zero.

from tester.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.