Skip to content

Commit 27b4784

Browse files
committed
Display Doctrine deprecations when running PHPUnit
This will give a signal that there is work to be done without blocking other contributions by failing the build.
1 parent 5a59923 commit 27b4784

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

phpunit.xml.dist

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1515
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
1616
colors="true"
17+
displayDetailsOnTestsThatTriggerDeprecations="true"
1718
displayDetailsOnTestsThatTriggerNotices="true"
1819
displayDetailsOnTestsThatTriggerWarnings="true"
1920
failOnNotice="true"
@@ -67,5 +68,12 @@
6768
<var name="privileged_db_port" value="3306"/>
6869
-->
6970
<env name="COLUMNS" value="120"/>
71+
<env name="DOCTRINE_DEPRECATIONS" value="trigger"/>
7072
</php>
73+
74+
<source ignoreSuppressionOfDeprecations="true">
75+
<include>
76+
<directory>src</directory>
77+
</include>
78+
</source>
7179
</phpunit>

tests/Tests/ORM/Functional/PaginationTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Doctrine\ORM\Query\AST\PathExpression;
1313
use Doctrine\ORM\Query\AST\SelectStatement;
1414
use Doctrine\ORM\Query\AST\WhereClause;
15+
use Doctrine\ORM\Query\SqlOutputWalker;
1516
use Doctrine\ORM\Query\SqlWalker;
1617
use Doctrine\ORM\Query\TreeWalkerAdapter;
1718
use Doctrine\ORM\Tools\Pagination\Paginator;
@@ -643,7 +644,7 @@ public function testCountQueryStripsParametersInSelect(): void
643644
self::assertCount(2, $getCountQuery->invoke($paginator)->getParameters());
644645
self::assertCount(9, $paginator);
645646

646-
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, SqlWalker::class);
647+
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, SqlOutputWalker::class);
647648

648649
$paginator = new Paginator($query);
649650

tests/Tests/ORM/Functional/ParserResultSerializationTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\Tests\OrmFunctionalTestCase;
1515
use Generator;
1616
use PHPUnit\Framework\Attributes\DataProvider;
17+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
1718
use ReflectionMethod;
1819
use Symfony\Component\VarExporter\Instantiator;
1920
use Symfony\Component\VarExporter\VarExporter;
@@ -34,6 +35,7 @@ protected function setUp(): void
3435

3536
/** @param Closure(ParserResult): ParserResult $toSerializedAndBack */
3637
#[DataProvider('provideToSerializedAndBack')]
38+
#[WithoutErrorHandler]
3739
public function testSerializeParserResultForQueryWithSqlWalker(Closure $toSerializedAndBack): void
3840
{
3941
$query = $this->_em

tests/Tests/ORM/Mapping/ClassMetadataTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
use DoctrineGlobalArticle;
5353
use LogicException;
5454
use PHPUnit\Framework\Attributes\Group as TestGroup;
55+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
5556
use ReflectionClass;
5657
use stdClass;
5758

@@ -1074,6 +1075,7 @@ public function testItAddingLifecycleCallbackOnEmbeddedClassIsIllegal(): void
10741075
$metadata->addLifecycleCallback('foo', 'bar');
10751076
}
10761077

1078+
#[WithoutErrorHandler]
10771079
public function testGettingAnFQCNForNullIsDeprecated(): void
10781080
{
10791081
$metadata = new ClassMetadata(self::class);
@@ -1112,6 +1114,7 @@ public function testClassNameMappingDiscriminatorValue(): void
11121114
);
11131115
}
11141116

1117+
#[WithoutErrorHandler]
11151118
public function testDiscriminatorMapWithSameClassMultipleTimesDeprecated(): void
11161119
{
11171120
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/issues/3519');

tests/Tests/ORM/Mapping/TableMappingTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@
66

77
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
88
use Doctrine\ORM\Mapping\Table;
9+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
910
use PHPUnit\Framework\TestCase;
1011

1112
final class TableMappingTest extends TestCase
1213
{
1314
use VerifyDeprecations;
1415

16+
#[WithoutErrorHandler]
1517
public function testDeprecationOnIndexesPropertyIsTriggered(): void
1618
{
1719
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/pull/11357');
1820

1921
new Table(indexes: []);
2022
}
2123

24+
#[WithoutErrorHandler]
2225
public function testDeprecationOnUniqueConstraintsPropertyIsTriggered(): void
2326
{
2427
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/pull/11357');

0 commit comments

Comments
 (0)