Skip to content

Commit

Permalink
Fix inheritance tests; revert changes in metadata reader providers
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Jun 25, 2024
1 parent 309bf55 commit cd47937
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/TableInheritance.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ public function run(Registry $registry): Registry

// All child should be presented in a schema as separated entity
// Every child will be handled according its table inheritance type
\assert($child->getRole() !== null && $entity !== null && isset($parent));
// todo should $parent be not null?
// \assert(isset($parent));

\assert($child->getRole() !== null && $entity !== null);

if (!$registry->hasEntity($child->getRole())) {
$registry->register($child);

Expand Down
3 changes: 1 addition & 2 deletions tests/Annotated/Fixtures/Fixtures16/ExecutiveProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
/**
* This proxy class doesn't have an {@see Entity} annotation (attribute) declaration,
* and it shouldn't be presented in Schema.
* Note: this behavior might be improved. There will be added support for
* annotated base class columns without Entity annotation declaration.
* But all the classes that extend this class should contain all the fields from this class.
*/
class ExecutiveProxy extends Employee
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Annotated/Functional/Driver/Common/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ public function getDriver(): Driver

public static function singularReadersProvider(): \Traversable
{
yield ['reader' => new AnnotationReader()];
yield ['reader' => new AttributeReader()];
yield ['Annotation reader' => new AnnotationReader()];
yield ['Attribute reader' => new AttributeReader()];
}

public static function allReadersProvider(): \Traversable
{
yield from static::singularReadersProvider();
yield ['reader' => new SelectiveReader([new AttributeReader(), new AnnotationReader()])];
yield ['Selective reader' => new SelectiveReader([new AttributeReader(), new AnnotationReader()])];
}

protected function getDatabase(): Database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function testTableInheritance(ReaderInterface $reader): void
$this->assertSame('secret', $loadedExecutive->hidden);
$this->assertSame(15000, $loadedExecutive->bonus);
$this->assertSame('executive', $loadedExecutive->getType());
$this->assertNull($loadedExecutive->proxyFieldWithAnnotation);
$this->assertSame('value', $loadedExecutive->proxyFieldWithAnnotation);
}

#[DataProvider('allReadersProvider')]
Expand Down

0 comments on commit cd47937

Please sign in to comment.