Skip to content

Commit c7ed9bd

Browse files
committed
Fix inheritance tests; revert changes in metadata reader providers
1 parent 309bf55 commit c7ed9bd

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

src/TableInheritance.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ public function run(Registry $registry): Registry
6666

6767
// All child should be presented in a schema as separated entity
6868
// Every child will be handled according its table inheritance type
69-
\assert($child->getRole() !== null && $entity !== null && isset($parent));
69+
// todo should $parent be not null?
70+
// \assert(isset($parent));
71+
72+
\assert($child->getRole() !== null && $entity !== null);
73+
7074
if (!$registry->hasEntity($child->getRole())) {
7175
$registry->register($child);
7276

tests/Annotated/Fixtures/Fixtures16/ExecutiveProxy.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
/**
1111
* This proxy class doesn't have an {@see Entity} annotation (attribute) declaration,
1212
* and it shouldn't be presented in Schema.
13-
* Note: this behavior might be improved. There will be added support for
14-
* annotated base class columns without Entity annotation declaration.
13+
* But all the classes that extend this class should contain all the fields from this class.
1514
*/
1615
class ExecutiveProxy extends Employee
1716
{
18-
/** @Column(type="string") */
17+
/** @Column(type="string", name="proxy") */
1918
#[Column(type: 'string', name: 'proxy')]
2019
public ?string $proxyFieldWithAnnotation = null;
2120

tests/Annotated/Functional/Driver/Common/BaseTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ public function getDriver(): Driver
115115

116116
public static function singularReadersProvider(): \Traversable
117117
{
118-
yield ['reader' => new AnnotationReader()];
119-
yield ['reader' => new AttributeReader()];
118+
yield ['Annotation reader' => new AnnotationReader()];
119+
yield ['Attribute reader' => new AttributeReader()];
120120
}
121121

122122
public static function allReadersProvider(): \Traversable
123123
{
124124
yield from static::singularReadersProvider();
125-
yield ['reader' => new SelectiveReader([new AttributeReader(), new AnnotationReader()])];
125+
yield ['Selective reader' => new SelectiveReader([new AttributeReader(), new AnnotationReader()])];
126126
}
127127

128128
protected function getDatabase(): Database

tests/Annotated/Functional/Driver/Common/Inheritance/JoinedTableTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function testTableInheritance(ReaderInterface $reader): void
125125
$this->assertSame('secret', $loadedExecutive->hidden);
126126
$this->assertSame(15000, $loadedExecutive->bonus);
127127
$this->assertSame('executive', $loadedExecutive->getType());
128-
$this->assertNull($loadedExecutive->proxyFieldWithAnnotation);
128+
$this->assertSame('value', $loadedExecutive->proxyFieldWithAnnotation);
129129
}
130130

131131
#[DataProvider('allReadersProvider')]

tests/Annotated/Functional/Driver/Common/InheritanceTestCase.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ public function testTableInheritance(ReaderInterface $reader): void
109109
$this->assertSame('foo_id', $schema['executive'][SchemaInterface::PARENT_KEY]);
110110
$this->assertSame('executives', $schema['executive'][SchemaInterface::TABLE]);
111111
$this->assertSame(
112-
['bonus' => 'bonus', 'foo_id' => 'id', 'hidden' => 'hidden'],
112+
[
113+
'bonus' => 'bonus',
114+
'proxyFieldWithAnnotation' => 'proxy',
115+
'foo_id' => 'id',
116+
'hidden' => 'hidden',
117+
],
113118
$schema['executive'][SchemaInterface::COLUMNS]
114119
);
115120

0 commit comments

Comments
 (0)