Skip to content

Commit

Permalink
Closes #5518
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 30, 2023
1 parent d2a23b7 commit 6fa4160
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 5 deletions.
7 changes: 7 additions & 0 deletions ChangeLog-10.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes of the PHPUnit 10.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.

## [10.5.6] - 202Y-MM-DD

### Fixed

* [#5518](https://github.com/sebastianbergmann/phpunit/issues/5518): Details about deprecations, notices, and warnings are not displayed when the TestDox result printer is used

## [10.5.5] - 2023-12-27

### Fixed
Expand Down Expand Up @@ -62,6 +68,7 @@ All notable changes of the PHPUnit 10.5 release series are documented in this fi

* [#5563](https://github.com/sebastianbergmann/phpunit/issues/5563): `createMockForIntersectionOfInterfaces()` does not automatically register mock object for expectation verification

[10.5.6]: https://github.com/sebastianbergmann/phpunit/compare/10.5.5...10.5
[10.5.5]: https://github.com/sebastianbergmann/phpunit/compare/10.5.4...10.5.5
[10.5.4]: https://github.com/sebastianbergmann/phpunit/compare/10.5.3...10.5.4
[10.5.3]: https://github.com/sebastianbergmann/phpunit/compare/10.5.2...10.5.3
Expand Down
10 changes: 5 additions & 5 deletions src/TextUI/Output/Facade.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ private static function createResultPrinter(Configuration $configuration): void
false,
false,
false,
false,
false,
false,
false,
false,
$configuration->displayDetailsOnTestsThatTriggerDeprecations(),
$configuration->displayDetailsOnTestsThatTriggerErrors(),
$configuration->displayDetailsOnTestsThatTriggerNotices(),
$configuration->displayDetailsOnTestsThatTriggerWarnings(),
$configuration->reverseDefectList(),
);
}

Expand Down
23 changes: 23 additions & 0 deletions tests/end-to-end/testdox/_files/DeprecationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture\TestDox;

use function trigger_error;
use PHPUnit\Framework\TestCase;

final class DeprecationTest extends TestCase
{
public function testDeprecation(): void
{
trigger_error('deprecation', E_USER_DEPRECATED);

$this->assertTrue(true);
}
}
23 changes: 23 additions & 0 deletions tests/end-to-end/testdox/_files/NoticeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture\TestDox;

use function trigger_error;
use PHPUnit\Framework\TestCase;

final class NoticeTest extends TestCase
{
public function testNotice(): void
{
trigger_error('notice', E_USER_NOTICE);

$this->assertTrue(true);
}
}
23 changes: 23 additions & 0 deletions tests/end-to-end/testdox/_files/WarningTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture\TestDox;

use function trigger_error;
use PHPUnit\Framework\TestCase;

final class WarningTest extends TestCase
{
public function testWarning(): void
{
trigger_error('warning', E_USER_WARNING);

$this->assertTrue(true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
TestDox: Test triggers deprecation and --display-deprecations is not used
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--no-progress';
$_SERVER['argv'][] = '--testdox';
$_SERVER['argv'][] = '--colors=never';
$_SERVER['argv'][] = __DIR__ . '/_files/DeprecationTest.php';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s

Time: %s, Memory: %s

Deprecation (PHPUnit\TestFixture\TestDox\Deprecation)
Deprecation

OK, but there were issues!
Tests: 1, Assertions: 1, Deprecations: 1.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--TEST--
TestDox: Test triggers deprecation and --display-deprecations is used
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--no-progress';
$_SERVER['argv'][] = '--testdox';
$_SERVER['argv'][] = '--colors=never';
$_SERVER['argv'][] = '--display-deprecations';
$_SERVER['argv'][] = __DIR__ . '/_files/DeprecationTest.php';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s

Time: %s, Memory: %s

Deprecation (PHPUnit\TestFixture\TestDox\Deprecation)
Deprecation

1 test triggered 1 deprecation:

1) %sDeprecationTest.php:19
deprecation

Triggered by:

* PHPUnit\TestFixture\TestDox\DeprecationTest::testDeprecation
%sDeprecationTest.php:17

OK, but there were issues!
Tests: 1, Assertions: 1, Deprecations: 1.
26 changes: 26 additions & 0 deletions tests/end-to-end/testdox/test-that-triggers-notice-default.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
TestDox: Test triggers notice and --display-notices is not used
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--no-progress';
$_SERVER['argv'][] = '--testdox';
$_SERVER['argv'][] = '--colors=never';
$_SERVER['argv'][] = __DIR__ . '/_files/NoticeTest.php';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s

Time: %s, Memory: %s

Notice (PHPUnit\TestFixture\TestDox\Notice)
Notice

OK, but there were issues!
Tests: 1, Assertions: 1, Notices: 1.
37 changes: 37 additions & 0 deletions tests/end-to-end/testdox/test-that-triggers-notice-details.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--TEST--
TestDox: Test triggers notice and --display-notices is used
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--no-progress';
$_SERVER['argv'][] = '--testdox';
$_SERVER['argv'][] = '--colors=never';
$_SERVER['argv'][] = '--display-notices';
$_SERVER['argv'][] = __DIR__ . '/_files/NoticeTest.php';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s

Time: %s, Memory: %s

Notice (PHPUnit\TestFixture\TestDox\Notice)
Notice

1 test triggered 1 notice:

1) %sNoticeTest.php:19
notice

Triggered by:

* PHPUnit\TestFixture\TestDox\NoticeTest::testNotice
%sNoticeTest.php:17

OK, but there were issues!
Tests: 1, Assertions: 1, Notices: 1.
26 changes: 26 additions & 0 deletions tests/end-to-end/testdox/test-that-triggers-warning-default.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
TestDox: Test triggers warning and --display-warning is not used
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--no-progress';
$_SERVER['argv'][] = '--testdox';
$_SERVER['argv'][] = '--colors=never';
$_SERVER['argv'][] = __DIR__ . '/_files/WarningTest.php';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s

Time: %s, Memory: %s

Warning (PHPUnit\TestFixture\TestDox\Warning)
Warning

OK, but there were issues!
Tests: 1, Assertions: 1, Warnings: 1.
37 changes: 37 additions & 0 deletions tests/end-to-end/testdox/test-that-triggers-warning-details.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--TEST--
TestDox: Test triggers warning and --display-warning is used
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--no-progress';
$_SERVER['argv'][] = '--testdox';
$_SERVER['argv'][] = '--colors=never';
$_SERVER['argv'][] = '--display-warnings';
$_SERVER['argv'][] = __DIR__ . '/_files/WarningTest.php';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s

Time: %s, Memory: %s

Warning (PHPUnit\TestFixture\TestDox\Warning)
Warning

1 test triggered 1 warning:

1) %sWarningTest.php:19
warning

Triggered by:

* PHPUnit\TestFixture\TestDox\WarningTest::testWarning
%sWarningTest.php:17

OK, but there were issues!
Tests: 1, Assertions: 1, Warnings: 1.

0 comments on commit 6fa4160

Please sign in to comment.