8000 [DoctrineBridge] Cleanup tests by fancyweb · Pull Request #50568 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DoctrineBridge] Cleanup tests #50568

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
Jun 5, 2023
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
8 changes: 1 addition & 7 deletions src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

namespace Symfony\Bridge\Doctrine\Tests;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use Doctrine\ORM\ORMSetup;
Expand Down Expand Up @@ -64,11 +62,7 @@ public static function createTestConfiguration(): Configuration
$config->setAutoGenerateProxyClasses(true);
$config->setProxyDir(sys_get_temp_dir());
$config->setProxyNamespace('SymfonyTests\Doctrine');
if (class_exists(AttributeDriver::class)) {
$config->setMetadataDriverImpl(new AttributeDriver([__DIR__.'/../Tests/Fixtures' => 'Symfony\Bridge\Doctrine\Tests\Fixtures'], true));
} else {
$config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader(), null, true));
}
$config->setMetadataDriverImpl(new AttributeDriver([__DIR__.'/../Tests/Fixtures' => 'Symfony\Bridge\Doctrine\Tests\Fixtures'], true));
if (class_exists(DefaultSchemaManagerFactory::class)) {
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
}
Expand Down
13 changes: 0 additions & 13 deletions src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,22 @@

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
*/
#[ORM\Entity]
class AssociationEntity
{
/**
* @var int
* @ORM\Id @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
private $id;

/**
* @ORM\ManyToOne(targetEntity="SingleIntIdEntity")
*
* @var \Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity
*/
#[ORM\ManyToOne(targetEntity: SingleIntIdEntity::class)]
public $single;

/**
* @ORM\ManyToOne(targetEntity="CompositeIntIdEntity")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="composite_id1", referencedColumnName="id1"),
* @ORM\JoinColumn(name="composite_id2", referencedColumnName="id2")
* })
*
* @var \Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity
*/
#[ORM\ManyToOne(targetEntity: CompositeIntIdEntity::class)]
Expand Down
13 changes: 0 additions & 13 deletions src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity2.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,22 @@

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
*/
#[ORM\Entity]
class AssociationEntity2
{
/**
* @var int
* @ORM\Id @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
private $id;

/**
* @ORM\ManyToOne(targetEntity="SingleIntIdNoToStringEntity")
*
* @var \Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity
*/
#[ORM\ManyToOne(targetEntity: SingleIntIdNoToStringEntity::class)]
public $single;

/**
* @ORM\ManyToOne(targetEntity="CompositeIntIdEntity")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="composite_id1", referencedColumnName="id1"),
* @ORM\JoinColumn(name="composite_id2", referencedColumnName="id2")
* })
*
* @var \Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity
*/
#[ORM\ManyToOne(targetEntity: CompositeIntIdEntity::class)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;

/**
* @Entity
*/
#[Entity]
class Person
{
/** @Id @Column(type="integer") */
#[Id, Column(type: 'integer')]
protected $id;

/** @Column(type="string") */
#[Column(type: 'string')]
public $name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;

/** @Entity */
#[Entity]
class Person
{
/** @Id @Column(type="integer") */
#[Id, Column(type: 'integer')]
protected $id;

/** @Column(type="string") */
#[Column(type: 'string')]
public $name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;

/**
* @Entity
*/
#[Entity]
class Person
{
/** @Id @Column(type="integer") */
#[Id, Column(type: 'integer')]
protected $id;

/** @Column(type="string") */
#[Column(type: 'string')]
public $name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,15 @@
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Embeddable;

/**
* @Embeddable
*/
#[Embeddable]
class Address
{

/** @Column(type="string") */
#[Column(type: 'string')]
public $street;

/** @Column(type="string") */
#[Column(type: 'string')]
public $zipCode;

/** @Column(type="string") */
#[Column(type: 'string')]
public $city;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;

/**
* @Entity
*/
#[Entity]
class Person
{
/** @Id @Column(type="integer") */
#[Id, Column(type: 'integer')]
protected $id;

/** @Column(type="string") */
#[Column(type: 'string')]
public $name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,15 @@
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;

/** @Entity */
#[Entity]
class CompositeIntIdEntity
{
/** @Id @Column(type="integer") */
#[Id, Column(type: 'integer')]
protected $id1;

/** @Id @Column(type="integer") */
#[Id, Column(type: 'integer')]
protected $id2;

/** @Column(type="string") */
#[Column(type: 'string')]
public $name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@

/**
* an entity that has two objects (class without toString methods) as primary key.
*
* @ORM\Entity
*/
#[ORM\Entity]
class CompositeObjectNoToStringIdEntity
{
/**
* @var SingleIntIdNoToStringEntity
*
* @ORM\Id
* @ORM\ManyToOne(targetEntity="SingleIntIdNoToStringEntity", cascade={"persist"})
* @ORM\JoinColumn(name="object_one_id")
*/
#[ORM\Id]
#[ORM\ManyToOne(targetEntity: SingleIntIdNoToStringEntity::class, cascade: ['persist'])]
Expand All @@ -35,10 +29,6 @@ class CompositeObjectNoToStringIdEntity

/**
* @var SingleIntIdNoToStringEntity
*
* @ORM\Id
* @ORM\ManyToOne(targetEntity="SingleIntIdNoToStringEntity", cascade={"persist"})
* @ORM\JoinColumn(name="object_two_id")
*/
#[ORM\Id]
#[ORM\ManyToOne(targetEntity: SingleIntIdNoToStringEntity::class, cascade: ['persist'])]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,15 @@
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;

/** @Entity */
#[Entity]
class CompositeStringIdEntity
{
/** @Id @Column(type="string") */
#[Id, Column(type: 'string')]
protected $id1;

/** @Id @Column(type="string") */
#[Id, Column(type: 'string')]
protected $id2;

/** @Column(type="string") */
#[Column(type: 'string')]
public $name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,12 @@

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Embeddable
*/
#[ORM\Embeddable]
class DoctrineLoaderEmbed
{
/**
* @ORM\Column(length=25)
*/
#[ORM\Column(length: 25)]
public $embeddedMaxLength;

/**
* @ORM\Embedded(class=DoctrineLoaderNestedEmbed::class)
*/
#[ORM\Embedded(class: DoctrineLoaderNestedEmbed::class)]
public $nestedEmbedded;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,75 +16,41 @@
use Symfony\Component\Validator\Constraints as Assert;

/**
* @ORM\Entity
* @UniqueEntity(fields={"alreadyMappedUnique"})
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
#[ORM\Entity, UniqueEntity(fields: ["alreadyMappedUnique"])]
class DoctrineLoaderEntity extends DoctrineLoaderParentEntity
{
/**
* @ORM\Id
* @ORM\Column
*/
#[ORM\Id, ORM\Column]
public $id;

/**
* @ORM\Column(length=20)
*/
#[ORM\Column(length: 20)]
public $maxLength;

/**
* @ORM\Column(length=20)
* @Assert\Length(min=5)
*/
#[ORM\Column(length: 20), Assert\Length(min: 5)]
public $mergedMaxLength;

/**
* @ORM\Column(length=20)
* @Assert\Length(min=1, max=10)
*/
#[ORM\Column(length: 20), Assert\Length(min: 1, max: 10)]
public $alreadyMappedMaxLength;

/**
* @ORM\Column(unique=true)
*/
#[ORM\Column(unique: true)]
public $unique;

/**
* @ORM\Column(unique=true)
*/
#[ORM\Column(unique: true)]
public $alreadyMappedUnique;

/**
* @ORM\Embedded(class=DoctrineLoaderEmbed::class)
*/
#[ORM\Embedded(class: DoctrineLoaderEmbed::class)]
public $embedded;

/** @ORM\Column(type="text", nullable=true, length=1000) */
#[ORM\Column(type: 'text', nullable: true, length: 1000)]
public $textField;

/** @ORM\Id @ORM\Column(type="guid", length=50) */
#[ORM\Id, ORM\Column(type: 'guid', length: 50)]
protected $guidField;

/** @ORM\Column(type="simple_array", length=100) */
#[ORM\Column(type: 'simple_array', length: 100)]
public $simpleArrayField = [];

/**
* @ORM\Column(length=10)
* @Assert\DisableAutoMapping
*/
#[ORM\Column(length: 10), Assert\DisableAutoMapping]
public $noAutoMapping;
}
13 changes: 0 additions & 13 deletions src/Symfony/Bridge/Doctrine/Tests/Fixtures/DoctrineLoaderEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,15 @@
use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\EnumInt;
use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\EnumString;

/**
* @ORM\Entity
*/
#[ORM\Entity]
class DoctrineLoaderEnum
{
/**
* @ORM\Id
* @ORM\Column
*/
#[ORM\Id, ORM\Column]
public $id;

/**
* @ORM\Column(type="string", enumType="Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\EnumString", length=1)
*/
#[ORM\Column(type: 'string', enumType: EnumString::class, length: 1)]
public $enumString;

/**
* @ORM\Column(type="integer", enumType="Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\EnumInt")
*/
#[ORM\Column(type: 'integer', enumType: EnumInt::class)]
public $enumInt;
}
Loading
0