Skip to content

Commit

Permalink
Merge pull request #11807 from greg0ire/display-deprecations
Browse files Browse the repository at this point in the history
Display Doctrine deprecations when running PHPUnit
  • Loading branch information
greg0ire authored Jan 25, 2025
2 parents 5a59923 + 27b4784 commit cf39e00
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
failOnNotice="true"
Expand Down Expand Up @@ -67,5 +68,12 @@
<var name="privileged_db_port" value="3306"/>
-->
<env name="COLUMNS" value="120"/>
<env name="DOCTRINE_DEPRECATIONS" value="trigger"/>
</php>

<source ignoreSuppressionOfDeprecations="true">
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
3 changes: 2 additions & 1 deletion tests/Tests/ORM/Functional/PaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Doctrine\ORM\Query\AST\PathExpression;
use Doctrine\ORM\Query\AST\SelectStatement;
use Doctrine\ORM\Query\AST\WhereClause;
use Doctrine\ORM\Query\SqlOutputWalker;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TreeWalkerAdapter;
use Doctrine\ORM\Tools\Pagination\Paginator;
Expand Down Expand Up @@ -643,7 +644,7 @@ public function testCountQueryStripsParametersInSelect(): void
self::assertCount(2, $getCountQuery->invoke($paginator)->getParameters());
self::assertCount(9, $paginator);

$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, SqlWalker::class);
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, SqlOutputWalker::class);

$paginator = new Paginator($query);

Expand Down
2 changes: 2 additions & 0 deletions tests/Tests/ORM/Functional/ParserResultSerializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Doctrine\Tests\OrmFunctionalTestCase;
use Generator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
use ReflectionMethod;
use Symfony\Component\VarExporter\Instantiator;
use Symfony\Component\VarExporter\VarExporter;
Expand All @@ -34,6 +35,7 @@ protected function setUp(): void

/** @param Closure(ParserResult): ParserResult $toSerializedAndBack */
#[DataProvider('provideToSerializedAndBack')]
#[WithoutErrorHandler]
public function testSerializeParserResultForQueryWithSqlWalker(Closure $toSerializedAndBack): void
{
$query = $this->_em
Expand Down
3 changes: 3 additions & 0 deletions tests/Tests/ORM/Mapping/ClassMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
use DoctrineGlobalArticle;
use LogicException;
use PHPUnit\Framework\Attributes\Group as TestGroup;
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
use ReflectionClass;
use stdClass;

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

#[WithoutErrorHandler]
public function testGettingAnFQCNForNullIsDeprecated(): void
{
$metadata = new ClassMetadata(self::class);
Expand Down Expand Up @@ -1112,6 +1114,7 @@ public function testClassNameMappingDiscriminatorValue(): void
);
}

#[WithoutErrorHandler]
public function testDiscriminatorMapWithSameClassMultipleTimesDeprecated(): void
{
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/issues/3519');
Expand Down
3 changes: 3 additions & 0 deletions tests/Tests/ORM/Mapping/TableMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@

use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
use Doctrine\ORM\Mapping\Table;
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
use PHPUnit\Framework\TestCase;

final class TableMappingTest extends TestCase
{
use VerifyDeprecations;

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

new Table(indexes: []);
}

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

0 comments on commit cf39e00

Please sign in to comment.