8000 minor #50568 [DoctrineBridge] Cleanup tests (fancyweb) · symfony/symfony@42d43b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 42d43b7

Browse files
minor #50568 [DoctrineBridge] Cleanup tests (fancyweb)
This PR was merged into the 6.4 branch. Discussion ---------- [DoctrineBridge] Cleanup tests | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - AttributeDriver is available since doctrine/orm 2.9.0 and we already conflict with < 2.12.0 so we can logically clean the annotations and the check Commits ------- 27c78a3 [DoctrineBridge] Cleanup tests
2 parents fe77631 + 27c78a3 commit 42d43b7

40 files changed

+1
-387
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests;
1313

14-
use Doctrine\Common\Annotations\AnnotationReader;
1514
use Doctrine\Common\EventManager;
1615
use Doctrine\DBAL\DriverManager;
1716
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
1817
use Doctrine\ORM\Configuration;
1918
use Doctrine\ORM\EntityManager;
20-
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
2119
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
2220
use Doctrine\ORM\Mapping\Driver\XmlDriver;
2321
use Doctrine\ORM\ORMSetup;
@@ -64,11 +62,7 @@ public static function createTestConfiguration(): Configuration
6462
$config->setAutoGenerateProxyClasses(true);
6563
$config->setProxyDir(sys_get_temp_dir());
6664
$config->setProxyNamespace('SymfonyTests\Doctrine');
67-
if (class_exists(AttributeDriver::class)) {
68-
$config->setMetadataDriverImpl(new AttributeDriver([__DIR__.'/../Tests/Fixtures' => 'Symfony\Bridge\Doctrine\Tests\Fixtures'], true));
69-
} else {
70-
$config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader(), null, true));
71-
}
65+
$config->setMetadataDriverImpl(new AttributeDriver([__DIR__.'/../Tests/Fixtures' => 'Symfony\Bridge\Doctrine\Tests\Fixtures'], true));
7266
if (class_exists(DefaultSchemaManagerFactory::class)) {
7367
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
7468
}

src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,22 @@
1313

1414
use Doctrine\ORM\Mapping as ORM;
1515

16-
/**
17-
* @ORM\Entity
18-
*/
1916
#[ORM\Entity]
2017
class AssociationEntity
2118
{
2219
/**
2320
* @var int
24-
* @ORM\Id @ORM\GeneratedValue
25-
* @ORM\Column(type="integer")
2621
*/
2722
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
2823
private $id;
2924

3025
/**
31-
* @ORM\ManyToOne(targetEntity="SingleIntIdEntity")
32-
*
3326
* @var \Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity
3427
*/
3528
#[ORM\ManyToOne(targetEntity: SingleIntIdEntity::class)]
3629
public $single;
3730

3831
/**
39-
* @ORM\ManyToOne(targetEntity="CompositeIntIdEntity")
40-
* @ORM\JoinColumns({
41-
* @ORM\JoinColumn(name="composite_id1", referencedColumnName="id1"),
42-
* @ORM\JoinColumn(name="composite_id2", referencedColumnName="id2")
43-
* })
44-
*
4532
* @var \Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity
4633
*/
4734
#[ORM\ManyToOne(targetEntity: CompositeIntIdEntity::class)]

src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity2.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,22 @@
1313

1414
use Doctrine\ORM\Mapping as ORM;
1515

16-
/**
17-
* @ORM\Entity
18-
*/
1916
#[ORM\Entity]
2017
class AssociationEntity2
2118
{
2219
/**
2320
* @var int
24-
* @ORM\Id @ORM\GeneratedValue
25-
* @ORM\Column(type="integer")
2621
*/
2722
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
2823
private $id;
2924

3025
/**
31-
* @ORM\ManyToOne(targetEntity="SingleIntIdNoToStringEntity")
32-
*
3326
* @var \Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity
3427
*/
3528
#[ORM\ManyToOne(targetEntity: SingleIntIdNoToStringEntity::class)]
3629
public $single;
3730

3831
/**
39-
* @ORM\ManyToOne(targetEntity="CompositeIntIdEntity")
40-
* @ORM\JoinColumns({
41-
* @ORM\JoinColumn(name="composite_id1", referencedColumnName="id1"),
42-
* @ORM\JoinColumn(name="composite_id2", referencedColumnName="id2")
43-
* })
44-
*
4532
* @var \Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity
4633
*/
4734
#[ORM\ManyToOne(targetEntity: CompositeIntIdEntity::class)]

src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/AnnotationsBundle/Entity/Person.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,12 @@
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\Id;
1717

18-
/**
19-
* @Entity
20-
*/
2118
#[Entity]
2219
class Person
2320
{
24-
/** @Id @Column(type="integer") */
2521
#[Id, Column(type: 'integer')]
2622
protected $id;
2723

28-
/** @Column(type="string") */
2924
#[Column(type: 'string')]
3025
public $name;
3126

src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/AnnotationsOneLineBundle/Entity/Person.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\Id;
1717

18-
/** @Entity */
1918
#[Entity]
2019
class Person
2120
{
22-
/** @Id @Column(type="integer") */
2321
#[Id, Column(type: 'integer')]
2422
protected $id;
2523

26-
/** @Column(type="string") */
2724
#[Column(type: 'string')]
2825
public $name;
2926

src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/AttributesBundle/AnnotatedEntity/Person.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,12 @@
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\Id;
1717

18-
/**
19-
* @Entity
20-
*/
2118
#[Entity]
2219
class Person
2320
{
24-
/** @Id @Column(type="integer") */
2521
#[Id, Column(type: 'integer')]
2622
protected $id;
2723

28-
/** @Column(type="string") */
2924
#[Column(type: 'string')]
3025
public $name;
3126

src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/FullEmbeddableAnnotationsBundle/Entity/Address.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,15 @@
1414
use Doctrine\ORM\Mapping\Column;
1515
use Doctrine\ORM\Mapping\Embeddable;
1616

17-
/**
18-
* @Embeddable
19-
*/
2017
#[Embeddable]
2118
class Address
2219
{
23-
24-
/** @Column(type="string") */
2520
#[Column(type: 'string')]
2621
public $street;
2722

28-
/** @Column(type="string") */
2923
#[Column(type: 'string')]
3024
public $zipCode;
3125

32-
/** @Column(type="string") */
3326
#[Column(type: 'string')]
3427
public $city;
3528

src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/NewAnnotationsBundle/src/Entity/Person.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,12 @@
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\Id;
1717

18-
/**
19-
* @Entity
20-
*/
2118
#[Entity]
2219
class Person
2320
{
24-
/** @Id @Column(type="integer") */
2521
#[Id, Column(type: 'integer')]
2622
protected $id;
2723

28-
/** @Column(type="string") */
2924
#[Column(type: 'string')]
3025
public $name;
3126

src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeIntIdEntity.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,15 @@
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\Id;
1717

18-
/** @Entity */
1918
#[Entity]
2019
class CompositeIntIdEntity
2120
{
22-
/** @Id @Column(type="integer") */
2321
#[Id, Column(type: 'integer')]
2422
protected $id1;
2523

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

30-
/** @Column(type="string") */
3127
#[Column(type: 'string')]
3228
public $name;
3329

src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,12 @@
1515

1616
/**
1717
* an entity that has two objects (class without toString methods) as primary key.
18-
*
19-
* @ORM\Entity
2018
*/
2119
#[ORM\Entity]
2220
class CompositeObjectNoToStringIdEntity
2321
{
2422
/**
2523
* @var SingleIntIdNoToStringEntity
26-
*
27-
* @ORM\Id
28-
* @ORM\ManyToOne(targetEntity="SingleIntIdNoToStringEntity", cascade={"persist"})
29-
* @ORM\JoinColumn(name="object_one_id")
3024
*/
3125
#[ORM\Id]
3226
#[ORM\ManyToOne(targetEntity: SingleIntIdNoToStringEntity::class, cascade: ['persist'])]
@@ -35,10 +29,6 @@ class CompositeObjectNoToStringIdEntity
3529

3630
/**
3731
* @var SingleIntIdNoToStringEntity
38-
*
39-
* @ORM\Id
40-
* @ORM\ManyToOne(targetEntity="SingleIntIdNoToStringEntity", cascade={"persist"})
41-
* @ORM\JoinColumn(name="object_two_id")
4232
*/
4333
#[ORM\Id]
4434
#[ORM\ManyToOne(targetEntity: SingleIntIdNoToStringEntity::class, cascade: ['persist'])]

src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeStringIdEntity.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,15 @@
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\Id;
1717

18-
/** @Entity */
1918
#[Entity]
2019
class CompositeStringIdEntity
2120
{
22-
/** @Id @Column(type="string") */
2321
#[Id, Column(type: 'string')]
2422
protected $id1;
2523

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

30-
/** @Column(type="string") */
3127
#[Column(type: 'string')]
3228
public $name;
3329

src/Symfony/Bridge/Doctrine/Tests/Fixtures/DoctrineLoaderEmbed.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,12 @@
1313

1414
use Doctrine\ORM\Mapping as ORM;
1515

16-
/**
17-
* @ORM\Embeddable
18-
*/
1916
#[ORM\Embeddable]
2017
class DoctrineLoaderEmbed
2118
{
22-
/**
23-
* @ORM\Column(length=25)
24-
*/
2519
#[ORM\Column(length: 25)]
2620
public $embeddedMaxLength;
2721

28-
/**
29-
* @ORM\Embedded(class=DoctrineLoaderNestedEmbed::class)
30-
*/
3122
#[ORM\Embedded(class: DoctrineLoaderNestedEmbed::class)]
3223
public $nestedEmbedded;
3324
}

src/Symfony/Bridge/Doctrine/Tests/Fixtures/DoctrineLoaderEntity.php

Lines changed: 0 additions & 34 deletions
97AE
Original file line numberDiff line numberDiff line change
@@ -16,75 +16,41 @@
1616
use Symfony\Component\Validator\Constraints as Assert;
1717

1818
/**
19-
* @ORM\Entity
20-
* @UniqueEntity(fields={"alreadyMappedUnique"})
21-
*
2219
* @author Kévin Dunglas <dunglas@gmail.com>
2320
*/
2421
#[ORM\Entity, UniqueEntity(fields: ["alreadyMappedUnique"])]
2522
class DoctrineLoaderEntity extends DoctrineLoaderParentEntity
2623
{
27-
/**
28-
* @ORM\Id
29-
* @ORM\Column
30-
*/
3124
#[ORM\Id, ORM\Column]
3225
public $id;
3326

34-
/**
35-
* @ORM\Column(length=20)
36-
*/
3727
#[ORM\Column(length: 20)]
3828
public $maxLength;
3929

40-
/**
41-
* @ORM\Column(length=20)
42-
* @Assert\Length(min=5)
43-
*/
4430
#[ORM\Column(length: 20), Assert\Length(min: 5)]
4531
public $mergedMaxLength;
4632

47-
/**
48-
* @ORM\Column(length=20)
49-
* @Assert\Length(min=1, max=10)
50-
*/
5133
#[ORM\Column(length: 20), Assert\Length(min: 1, max: 10)]
5234
public $alreadyMappedMaxLength;
5335

54-
/**
55-
* @ORM\Column(unique=true)
56-
*/
5736
#[ORM\Column(unique: true)]
5837
public $unique;
5938

60-
/**
61-
* @ORM\Column(unique=true)
62-
*/
6339
#[ORM\Column(unique: true)]
6440
public $alreadyMappedUnique;
6541

66-
/**
67-
* @ORM\Embedded(class=DoctrineLoaderEmbed::class)
68-
*/
6942
#[ORM\Embedded(class: DoctrineLoaderEmbed::class)]
7043
public $embedded;
7144

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

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

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

84-
/**
85-
* @ORM\Column(length=10)
86-
* @Assert\DisableAutoMapping
87-
*/
8854
#[ORM\Column(length: 10), Assert\DisableAutoMapping]
8955
public $noAutoMapping;
9056
}

src/Symfony/Bridge/Doctrine/Tests/Fixtures/DoctrineLoaderEnum.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,15 @@
1515
use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\EnumInt;
1616
use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\EnumString;
1717

18-
/**
19-
* @ORM\Entity
20-
*/
2118
#[ORM\Entity]
2219
class DoctrineLoaderEnum
2320
{
24-
/**
25-
* @ORM\Id
26-
* @ORM\Column
27-
*/
2821
#[ORM\Id, ORM\Column]
2922
public $id;
3023

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

37-
/**
38-
* @ORM\Column(type="integer", enumType="Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\EnumInt")
39-
*/
4027
#[ORM\Column(type: 'integer', enumType: EnumInt::class)]
4128
public $enumInt;
4229
}

0 commit comments

Comments
 (0)
0