Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

275
Views
What could cause PHPUnit to not print very large error messages?

This seems to happen only on my system. Nobody else could reproduce it. If the error's message is too large (about 65k bytes in my case) nothing gets printed on screen. I'm using PHP 7.1.3 on Windows 7, with the default php.ini (memory limit set to 8gb) and the default PHPUnit 6.0.13 configuration. The error does not appear in both prompt and powershell.

<?php

use PHPUnit\Framework\Constraint\Constraint;
use PHPUnit\Framework\TestCase;

class MyConstraint extends Constraint
{
    protected $expected;

    function __construct($expected){
        parent::__construct();
        $this->expected = $expected;
    }

    protected function matches($actual){
        return false;
    }

    function failureDescription($other): string{
        return "desc";
    }

    function toString(){
        return "description";
    }

    function additionalFailureDescription($other): string{
        return str_repeat("x", 100000);
        // If set to a smaller dump, error will appear
        // some people I asked to try could dump one million
        // bytes without problems, while I can't print more
        // than about 50k
    }
}

class SomeTest extends TestCase
{
    function testBigDump(){
        TestCase::assertThat("irrelevant", new MyConstraint("irrelevant"));
    }
}

?>

And this is what I get on screen:

PHPUnit 6.0.13 by Sebastian Bergmann and contributors.

Runtime: PHPDBG 7.1.3 Configuration: ..............

F 1 / 1 (100%)

Time: 361 ms, Memory: 6.00MB

There was 1 failure:

1) SomeTest::testBigDump

                             <------- Notice no error description here

FAILURES! Tests: 1, Assertions: 1, Failures: 1.

Do you have any idea what could cause this? Thank you in advance.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Something in your configuration is running phpunit test via phpdbg

I've recreated this issue, attempting to replicate the environment as much as possible using a Windows 7 VM.

The clue was the Runtime: PHPDBG line in your dump. Apparently something about the phpdbg runtime prevents large buffers from working correctly. See my output below, both the initial output when run via phpdbg.exe (missing test description) and then when run via php.exe (truncated, obviously):

C:\project>phpdbg -r phpunit-6.1.0.phar -v test.php
[Welcome to phpdbg, the interactive PHP debugger, v0.5.0]
To get help using phpdbg type "help" and press enter
[Please report bugs to <http://bugs.php.net/report.php>]
PHPUnit 6.1.0 by Sebastian Bergmann and contributors.

Runtime:       PHPDBG 7.1.4

F                                                                   1 / 1 (100%)


Time: 99 ms, Memory: 22.00MB

There was 1 failure:

1) SomeTest::testBigDump

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
[Script ended normally]

C:\project>php phpunit-6.1.0.phar test.php
PHPUnit 6.1.0 by Sebastian Bergmann and contributors.

F                                                                   1 / 1 (100%)


Time: 109 ms, Memory: 8.00MB

There was 1 failure:

1) SomeTest::testBigDump
Failed asserting that desc.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----- Snip -----
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!