Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Output from error_log() is not displayed when test fails #6173

Copy link
Copy link
Closed
@simonLeary42

Description

@simonLeary42
Issue body actions
Q A
PHPUnit version 12.1.0
PHP version 8.3.6
Installation Method Composer
hakasapl/phpopenldaper           1.0.5    Wrapper for php-ldap
hamcrest/hamcrest-php            2.0.1    This is the PHP port of Hamcrest Matchers
mockery/mockery                  1.6.12   Mockery is a simple yet flexible PHP mock object framework
myclabs/deep-copy                1.13.0   Create deep copies (clones) of your objects
nikic/php-parser                 5.4.0    A PHP parser written in PHP
paragonie/constant_time_encoding 3.0.0    Constant-time Implementations of RFC 4648 Encoding (Base...
paragonie/random_compat          9.99.100 PHP 5.x polyfill for random_bytes() and random_int() fro...
phar-io/manifest                 2.0.4    Component for reading phar.io manifest information from ...
phar-io/version                  3.2.1    Library for handling version information and constraints
phpmailer/phpmailer              6.9.3    PHPMailer is a full-featured email creation and transfer...
phpseclib/phpseclib              3.0.43   PHP Secure Communications Library - Pure-PHP implementat...
phpunit/php-code-coverage        12.1.2   Library that provides collection, processing, and render...
phpunit/php-file-iterator        6.0.0    FilterIterator implementation that filters files based o...
phpunit/php-invoker              6.0.0    Invoke callables with a timeout
phpunit/php-text-template        5.0.0    Simple template engine.
phpunit/php-timer                8.0.0    Utility class for timing
phpunit/phpunit                  12.0.10  The PHP Unit Testing framework.
psr/log                          3.0.2    Common interface for logging libraries
sebastian/cli-parser             4.0.0    Library for parsing CLI options
sebastian/comparator             7.0.1    Provides the functionality to compare PHP values for equ...
sebastian/complexity             5.0.0    Library for calculating the complexity of PHP code units
sebastian/diff                   7.0.0    Diff implementation
sebastian/environment            8.0.0    Provides functionality to handle HHVM/PHP environments
sebastian/exporter               7.0.0    Provides the functionality to export PHP variables for v...
sebastian/global-state           8.0.0    Snapshotting of global state
sebastian/lines-of-code          4.0.0    Library for counting the lines of code in PHP source code
sebastian/object-enumerator      7.0.0    Traverses array structures and object graphs to enumerat...
sebastian/object-reflector       5.0.0    Allows reflection of object attributes, including inheri...
sebastian/recursion-context      7.0.0    Provides functionality to recursively process PHP variables
sebastian/type                   6.0.2    Collection of value objects that represent the types of ...
sebastian/version                6.0.0    Library that helps with managing the version number of G...
staabm/side-effects-detector     1.0.5    A static analysis tool to detect side effects in PHP code
theseer/tokenizer                1.2.3    A small library for converting tokenized PHP source code...

Summary

Current behavior

How to reproduce

<?php
use PHPUnit\Framework\TestCase;
class ErrorLogTest extends TestCase {
    public function test_log_success(){
        error_log("hello, world!");
        $this->assertTrue(true);
    }
    public function test_log_fail(){
        error_log("hello, world!");
        $this->assertTrue(false);
    }
}
PHPUnit 12.1.0 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.6

hello, world!
.F                                                                  2 / 2 (100%)

Time: 00:00.017, Memory: 8.00 MB

There was 1 failure:

1) ErrorLogTest::test_log_fail
Failed asserting that false is true.

/var/www/unity-web-portal/test/functional/ErrorLogTest.php:10

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

Expected behavior

PHPUnit 12.0.10 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.6

hello, world!
.hello, world!
F                                                                  2 / 2 (100%)

Time: 00:00.010, Memory: 8.00 MB

There was 1 failure:

1) ErrorLogTest::test_log_fail
Failed asserting that false is true.

/var/www/unity-web-portal/test/functional/ErrorLogTest.php:10

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

In 12.0.10, I see two hello worlds, and in 12.1.0, I see only one. I have been using error_log to investigate failed tests where I can't use xdebug. Workaround is to use error_log(..., 4) to overstep the ini setting.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.