From 4e462cdbeb2861aa8ef085aedc04a6f2687f043b Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Mon, 10 May 2021 18:52:10 +0200 Subject: [PATCH] Address review comment about keeping the target entity type detection. --- .../Tests/ORM/Mapping/AbstractMappingDriverTest.php | 3 +++ tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index 2a9dcc9b129..28a2abefc05 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -278,6 +278,9 @@ public function testFieldIsNullableByType(): void // Explicit Not Nullable $this->assertFalse($class->isNullable('username')); + + $this->assertEquals(CmsEmail::class, $class->getAssociationMapping('email')['targetEntity']); + $this->assertEquals(CmsEmail::class, $class->getAssociationMapping('mainEmail')['targetEntity']); } public function testFieldTypeFromReflection(): void diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 900736c9a21..ae142ad70c0 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -127,6 +127,12 @@ public function testFieldIsNullableByType(): void // Explicit Not Nullable $cm->mapField(['fieldName' => 'username', 'length' => 50]); $this->assertFalse($cm->isNullable('username')); + + $cm->mapOneToOne(['fieldName' => 'email', 'joinColumns' => [[]]]); + $this->assertEquals(CmsEmail::class, $cm->getAssociationMapping('email')['targetEntity']); + + $cm->mapManyToOne(['fieldName' => 'mainEmail']); + $this->assertEquals(CmsEmail::class, $cm->getAssociationMapping('mainEmail')['targetEntity']); } public function testFieldTypeFromReflection(): void