Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7930607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:28:45+00:00 2026-06-03T20:28:45+00:00

I am wondering about what strict mode is in PHPUnit ? eg: phpunit –strict

  • 0

I am wondering about what “strict mode is in PHPUnit” ?

eg:

phpunit --strict

or in phpunit.xml

<phpunit strict="true"/>

I turned it on just to try it and my tests started failing with

PHP_Invoker_TimeoutException: Execution aborted after 1 second
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:28:48+00:00Added an answer on June 3, 2026 at 8:28 pm

    Short answer:
    for long running tests use an annotation to increase the allowed run time:

    @large // 10 seconds
    @medium // 5 seconds
    @small // 1 second max <-- Default, so no point using
    

    Long Answer:

    Here is an updated set of info that was derived with the help of @Crozin.

    In my case the error was that a test was taking too long (>1 second.) (Doctrine ORM schema drop + create can slow things down, see this ZendCast for what I was doing). This was causing an issue (and some output) from PHP_Invoker. Strict mode doesnt allow any output.

    By Reading / Reverse engineering /usr/share/php/pear/share/pear/PHPUnit/Util/Test.php::getSize() (and getGroups() on the same class) .. I figured out there are 3 undocumented annotations we can use:

    @large  // 10 seconds
    @medium // 5 seconds
    @small // 1 second max run time
    

    They can be specified on the class level or on the method level.
    Issue #490 on the PHPUnit github hints at issues with supplying both class level and method level so YMMV if you mix them. As crozin said, the allotted time outs are 10,5,1 seconds respectively.

    A alternate solution was to increase how long an invoked function is allowed to run (on my slow computer).

    sudo vi /usr/share/php/pear/share/pear/PHP/Invoker.php
    
    Increase line 1 "declare(ticks = 1);" to
        "declare(ticks = 10);" // or any higher int that meets your needs 
    

    Here is a bunch of information about strict mode that helped me find the solution:

    PHP_Invoker
    A utility class for invoking callables with a timeout. This package is required to enforce test timeouts in strict mode. [PHPUnit Install Instructions]

    Strict Mode
    Tests that do not assert anything are marked as incomplete
    Test that are incomplete (or skipped) yield no code coverage Slideshare by Sebastian Bergmann (slide 10)

    Note
    Please note that PHPUnit swallows all output that is emitted during the execution of a test. In strict mode, a test that emits output will fail. Testing output section of PHPUnit Manual

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering about the performance impact of copying very large php variables. For example
Just wondering about this code below... when I turn off my internet connection and
Just wondering about some practice about this; I have made a simple visual C#
I was just wondering about something. I have a frame that loads pages and
I was just wondering about the considerations to be followed while packing items (int,
I just learned about Nvidia's thrust library. Just to try it wrote a small
I was wondering about caching dynamic PHP pages. Is it really about pre-compiling the
I was wondering about ?? signs in C# code. What is it for? And
I have been wondering about the reload() function in python, which seems like it
I been wondering about this for a while. It seems like there are so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.