Skip to content

Commit 670da4f

Browse files
committed
feature #39696 [DoctrineBridge] Deprecate internal test helpers in Test namespace (wouterj)
This PR was squashed before being merged into the 5.3-dev branch. Discussion ---------- [DoctrineBridge] Deprecate internal test helpers in Test namespace | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - These helper classes are only used internally in the DoctrineBridge and, as far as I can see, only make sense within the test suite of the DoctrineBridge. Having them in `Test` means they are covered by the BC promise, I think we can make our lives more easy by moving them to `Tests`. Commits ------- a174e6b [DoctrineBridge] Deprecate internal test helpers in Test namespace
2 parents 13cfc00 + a174e6b commit 670da4f

File tree

11 files changed

+81
-8
lines changed

11 files changed

+81
-8
lines changed

src/Symfony/Bridge/Doctrine/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.3.0
5+
-----
6+
7+
* deprecated `DoctrineTestHelper` and `TestRepositoryFactory`
8+
49
5.2.0
510
-----
611

src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* Provides utility functions needed in tests.
2626
*
2727
* @author Bernhard Schussek <bschussek@gmail.com>
28+
*
29+
* @deprecated in 5.3, will be removed in 6.0.
2830
*/
2931
class DoctrineTestHelper
3032
{
@@ -39,6 +41,10 @@ public static function createTestEntityManager(Configuration $config = null)
3941
TestCase::markTestSkipped('Extension pdo_sqlite is required.');
4042
}
4143

44+
if (__CLASS__ === static::class) {
45+
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
46+
}
47+
4248
if (null === $config) {
4349
$config = self::createTestConfiguration();
4450
}
@@ -56,6 +62,10 @@ public static function createTestEntityManager(Configuration $config = null)
5662
*/
5763
public static function createTestConfiguration()
5864
{
65+
if (__CLASS__ === static::class) {
66+
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
67+
}
68+
5969
$config = new Configuration();
6070
$config->setEntityNamespaces(['SymfonyTestsDoctrine' => 'Symfony\Bridge\Doctrine\Tests\Fixtures']);
6171
$config->setAutoGenerateProxyClasses(true);
@@ -73,6 +83,10 @@ public static function createTestConfiguration()
7383
*/
7484
public static function createTestConfigurationWithXmlLoader()
7585
{
86+
if (__CLASS__ === static::class) {
87+
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
88+
}
89+
7690
$config = static::createTestConfiguration();
7791

7892
$driverChain = new MappingDriverChain();

src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818

1919
/**
2020
* @author Andreas Braun <alcaeus@alcaeus.org>
21+
*
22+
* @deprecated in 5.3, will be removed in 6.0.
2123
*/
22-
final class TestRepositoryFactory implements RepositoryFactory
24+
class TestRepositoryFactory implements RepositoryFactory
2325
{
2426
/**
2527
* @var ObjectRepository[]
@@ -33,6 +35,10 @@ final class TestRepositoryFactory implements RepositoryFactory
3335
*/
3436
public function getRepository(EntityManagerInterface $entityManager, $entityName)
3537
{
38+
if (__CLASS__ === static::class) {
39+
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
40+
}
41+
3642
$repositoryHash = $this->getRepositoryHash($entityManager, $entityName);
3743

3844
if (isset($this->repositoryList[$repositoryHash])) {
@@ -44,6 +50,10 @@ public function getRepository(EntityManagerInterface $entityManager, $entityName
4450

4551
public function setRepository(EntityManagerInterface $entityManager, string $entityName, ObjectRepository $repository)
4652
{
53+
if (__CLASS__ === static::class) {
54+
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
55+
}
56+
4757
$repositoryHash = $this->getRepositoryHash($entityManager, $entityName);
4858

4959
$this->repositoryList[$repositoryHash] = $repository;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests;
13+
14+
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper as TestDoctrineTestHelper;
15+
16+
/**
17+
* Provides utility functions needed in tests.
18+
*
19+
* @author Bernhard Schussek <bschussek@gmail.com>
20+
*/
21+
final class DoctrineTestHelper extends TestDoctrineTestHelper
22+
{
23+
}

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Doctrine\ORM\Version;
1818
use PHPUnit\Framework\TestCase;
1919
use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
20-
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
20+
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
2121
use Symfony\Bridge\Doctrine\Types\UlidType;
2222
use Symfony\Bridge\Doctrine\Types\UuidType;
2323
use Symfony\Component\Form\Exception\TransformationFailedException;

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Doctrine\ORM\Tools\SchemaTool;
1515
use Doctrine\Persistence\ManagerRegistry;
1616
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
17-
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
17+
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
1818
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
1919
use Symfony\Component\Form\Extension\Core\CoreExtension;
2020
use Symfony\Component\Form\Test\FormPerformanceTestCase;

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
2121
use Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser;
2222
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
23-
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
23+
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
2424
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity;
2525
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeStringIdEntity;
2626
use Symfony\Bridge\Doctrine\Tests\Fixtures\GroupableEntity;

src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use PHPUnit\Framework\TestCase;
1919
use Symfony\Bridge\Doctrine\Security\User\EntityUserProvider;
2020
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
21-
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
21+
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
2222
use Symfony\Bridge\Doctrine\Tests\Fixtures\User;
2323
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
2424

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests;
13+
14+
use Symfony\Bridge\Doctrine\Test\TestRepositoryFactory as TestTestRepositoryFactory;
15+
16+
/**
17+
* @author Andreas Braun <alcaeus@alcaeus.org>
18+
*/
19+
final class TestRepositoryFactory extends TestTestRepositoryFactory
20+
{
21+
}

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
use Doctrine\Persistence\Mapping\ClassMetadata;
1919
use Doctrine\Persistence\ObjectManager;
2020
use Doctrine\Persistence\ObjectRepository;
21-
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
22-
use Symfony\Bridge\Doctrine\Test\TestRepositoryFactory;
21+
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
2322
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity;
2423
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2;
2524
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeObjectNoToStringIdEntity;
@@ -31,6 +30,7 @@
3130
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;
3231
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdStringWrapperNameEntity;
3332
use Symfony\Bridge\Doctrine\Tests\Fixtures\Type\StringWrapper;
33+
use Symfony\Bridge\Doctrine\Tests\TestRepositoryFactory;
3434
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
3535
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
3636
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy