[DoctrineBridge] Deprecate internal test helpers in Test namespace
This commit is contained in:
parent
d2e589c0ec
commit
a174e6b4de
@ -1,6 +1,11 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
5.3.0
|
||||
-----
|
||||
|
||||
* deprecated `DoctrineTestHelper` and `TestRepositoryFactory`
|
||||
|
||||
5.2.0
|
||||
-----
|
||||
|
||||
|
@ -25,6 +25,8 @@ use PHPUnit\Framework\TestCase;
|
||||
* Provides utility functions needed in tests.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated in 5.3, will be removed in 6.0.
|
||||
*/
|
||||
class DoctrineTestHelper
|
||||
{
|
||||
@ -39,6 +41,10 @@ class DoctrineTestHelper
|
||||
TestCase::markTestSkipped('Extension pdo_sqlite is required.');
|
||||
}
|
||||
|
||||
if (__CLASS__ === static::class) {
|
||||
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
|
||||
}
|
||||
|
||||
if (null === $config) {
|
||||
$config = self::createTestConfiguration();
|
||||
}
|
||||
@ -56,6 +62,10 @@ class DoctrineTestHelper
|
||||
*/
|
||||
public static function createTestConfiguration()
|
||||
{
|
||||
if (__CLASS__ === static::class) {
|
||||
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
|
||||
}
|
||||
|
||||
$config = new Configuration();
|
||||
$config->setEntityNamespaces(['SymfonyTestsDoctrine' => 'Symfony\Bridge\Doctrine\Tests\Fixtures']);
|
||||
$config->setAutoGenerateProxyClasses(true);
|
||||
@ -73,6 +83,10 @@ class DoctrineTestHelper
|
||||
*/
|
||||
public static function createTestConfigurationWithXmlLoader()
|
||||
{
|
||||
if (__CLASS__ === static::class) {
|
||||
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
|
||||
}
|
||||
|
||||
$config = static::createTestConfiguration();
|
||||
|
||||
$driverChain = new MappingDriverChain();
|
||||
|
@ -18,8 +18,10 @@ use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
/**
|
||||
* @author Andreas Braun <alcaeus@alcaeus.org>
|
||||
*
|
||||
* @deprecated in 5.3, will be removed in 6.0.
|
||||
*/
|
||||
final class TestRepositoryFactory implements RepositoryFactory
|
||||
class TestRepositoryFactory implements RepositoryFactory
|
||||
{
|
||||
/**
|
||||
* @var ObjectRepository[]
|
||||
@ -33,6 +35,10 @@ final class TestRepositoryFactory implements RepositoryFactory
|
||||
*/
|
||||
public function getRepository(EntityManagerInterface $entityManager, $entityName)
|
||||
{
|
||||
if (__CLASS__ === static::class) {
|
||||
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
|
||||
}
|
||||
|
||||
$repositoryHash = $this->getRepositoryHash($entityManager, $entityName);
|
||||
|
||||
if (isset($this->repositoryList[$repositoryHash])) {
|
||||
@ -44,6 +50,10 @@ final class TestRepositoryFactory implements RepositoryFactory
|
||||
|
||||
public function setRepository(EntityManagerInterface $entityManager, string $entityName, ObjectRepository $repository)
|
||||
{
|
||||
if (__CLASS__ === static::class) {
|
||||
trigger_deprecation('symfony/doctrine-bridge', '5.3', '"%s" is deprecated and will be removed in 6.0.', __CLASS__);
|
||||
}
|
||||
|
||||
$repositoryHash = $this->getRepositoryHash($entityManager, $entityName);
|
||||
|
||||
$this->repositoryList[$repositoryHash] = $repository;
|
||||
|
23
src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php
Normal file
23
src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bridge\Doctrine\Tests;
|
||||
|
||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper as TestDoctrineTestHelper;
|
||||
|
||||
/**
|
||||
* Provides utility functions needed in tests.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
final class DoctrineTestHelper extends TestDoctrineTestHelper
|
||||
{
|
||||
}
|
@ -17,7 +17,7 @@ use Doctrine\DBAL\Types\Type;
|
||||
use Doctrine\ORM\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
|
||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Types\UlidType;
|
||||
use Symfony\Bridge\Doctrine\Types\UuidType;
|
||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
|
@ -14,7 +14,7 @@ namespace Symfony\Bridge\Doctrine\Tests\Form\Type;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
|
||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
|
||||
use Symfony\Component\Form\Extension\Core\CoreExtension;
|
||||
use Symfony\Component\Form\Test\FormPerformanceTestCase;
|
||||
|
@ -20,7 +20,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
|
||||
use Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeStringIdEntity;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\GroupableEntity;
|
||||
|
@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\Doctrine\Security\User\EntityUserProvider;
|
||||
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
|
||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\User;
|
||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||
|
||||
|
21
src/Symfony/Bridge/Doctrine/Tests/TestRepositoryFactory.php
Normal file
21
src/Symfony/Bridge/Doctrine/Tests/TestRepositoryFactory.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bridge\Doctrine\Tests;
|
||||
|
||||
use Symfony\Bridge\Doctrine\Test\TestRepositoryFactory as TestTestRepositoryFactory;
|
||||
|
||||
/**
|
||||
* @author Andreas Braun <alcaeus@alcaeus.org>
|
||||
*/
|
||||
final class TestRepositoryFactory extends TestTestRepositoryFactory
|
||||
{
|
||||
}
|
@ -18,8 +18,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
use Doctrine\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Test\TestRepositoryFactory;
|
||||
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeObjectNoToStringIdEntity;
|
||||
@ -31,6 +30,7 @@ use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdStringWrapperNameEntity;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\Type\StringWrapper;
|
||||
use Symfony\Bridge\Doctrine\Tests\TestRepositoryFactory;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
@ -12,7 +12,7 @@
|
||||
namespace Symfony\Bridge\Doctrine\Tests\Validator;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\BaseUser;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoctrineLoaderEmbed;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoctrineLoaderEntity;
|
||||
|
Reference in New Issue
Block a user