Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DoctrineBridge] Deprecate internal test helpers in Test namespace #39696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 5 src/Symfony/Bridge/Doctrine/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

5.3.0
-----

* deprecated `DoctrineTestHelper` and `TestRepositoryFactory`

5.2.0
-----

Expand Down
14 changes: 14 additions & 0 deletions 14 src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
* Provides utility functions needed in tests.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated in 5.3, will be removed in 6.0.
*/
class DoctrineTestHelper
{
Expand All @@ -39,6 +41,10 @@ public static function createTestEntityManager(Configuration $config = null)
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();
}
Expand All @@ -56,6 +62,10 @@ public static function createTestEntityManager(Configuration $config = null)
*/
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);
Expand All @@ -73,6 +83,10 @@ public static function createTestConfiguration()
*/
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();
Expand Down
12 changes: 11 additions & 1 deletion 12 src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

/**
* @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[]
Expand All @@ -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])) {
Expand All @@ -44,6 +50,10 @@ public function getRepository(EntityManagerInterface $entityManager, $entityName

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;
Expand Down
23 changes: 23 additions & 0 deletions 23 src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php
Original file line number Diff line number Diff line change
@@ -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
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
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;

Expand Down
21 changes: 21 additions & 0 deletions 21 src/Symfony/Bridge/Doctrine/Tests/TestRepositoryFactory.php
Original file line number Diff line number Diff line change
@@ -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
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
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;
Expand All @@ -31,6 +30,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.