Skip to content

Commit 69dc8aa

Browse files
committed
Show deprecations while running tests
1 parent 11a5bc2 commit 69dc8aa

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

packages/guides/tests/unit/Compiler/CompilerContextTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,22 @@
1515

1616
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
1717
use phpDocumentor\Guides\Nodes\ProjectNode;
18+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
1819
use PHPUnit\Framework\TestCase;
1920

2021
final class CompilerContextTest extends TestCase
2122
{
2223
use VerifyDeprecations;
2324

25+
#[WithoutErrorHandler]
2426
public function testTriggersDeprecationOnContextExtend(): void
2527
{
2628
$this->expectDeprecationWithIdentifier('https://github.com/phpDocumentor/guides/issues/971');
2729
$context = new class (new ProjectNode()) extends CompilerContext{
2830
};
2931
}
3032

33+
#[WithoutErrorHandler]
3134
public function testNoDeprecationOnNormalConstruct(): void
3235
{
3336
$this->expectNoDeprecationWithIdentifier('https://github.com/phpDocumentor/guides/issues/971');

phpunit.xml.dist

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
<phpunit
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
6-
bootstrap="vendor/autoload.php"
6+
bootstrap="tests/bootstrap.php"
77
colors="true"
88
beStrictAboutTestsThatDoNotTestAnything="true"
99
beStrictAboutOutputDuringTests="true"
1010
beStrictAboutChangesToGlobalState="true"
1111
failOnNotice="true"
1212
failOnWarning="true"
13+
failOnDeprecation="true"
1314
displayDetailsOnTestsThatTriggerNotices="true"
1415
displayDetailsOnTestsThatTriggerWarnings="true"
1516
displayDetailsOnTestsThatTriggerErrors="true"
17+
displayDetailsOnTestsThatTriggerDeprecations="true"
1618
cacheDirectory=".cache/.phpunit.cache"
1719
requireCoverageMetadata="false"
1820
>
@@ -28,7 +30,7 @@
2830
</testsuite>
2931
</testsuites>
3032
<coverage/>
31-
<source>
33+
<source ignoreSuppressionOfDeprecations="true">
3234
<include>
3335
<directory suffix=".php">packages/**/src</directory>
3436
</include>

tests/bootstrap.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Doctrine\Deprecations\Deprecation;
6+
7+
require_once dirname(__DIR__) . '/vendor/autoload.php';
8+
9+
Deprecation::enableWithTriggerError();
10+
Deprecation::withoutDeduplication();

0 commit comments

Comments
 (0)