@@ -69,6 +69,9 @@ public function testTableInheritance(ReaderInterface $reader): void
6969 // Ceo - Single table inheritance {value: ceo}
7070 // Beaver - Separate table
7171
72+ // Tool
73+ $ this ->assertArrayHasKey ('tool ' , $ schema );
74+
7275 // Person
7376 $ this ->assertCount (3 , $ schema ['person ' ][SchemaInterface::CHILDREN ]);
7477 $ this ->assertEquals ([
@@ -91,38 +94,62 @@ public function testTableInheritance(ReaderInterface $reader): void
9194 $ this ->assertEmpty ($ schema ['person ' ][SchemaInterface::PARENT ] ?? null );
9295 $ this ->assertEmpty ($ schema ['person ' ][SchemaInterface::PARENT_KEY ] ?? null );
9396 $ this ->assertSame ('people ' , $ schema ['person ' ][SchemaInterface::TABLE ]);
97+ $ this ->assertSame (
98+ [
99+ 'foo_id ' => 'id ' ,
100+ 'name ' => 'name ' ,
101+ 'type ' => 'type ' ,
102+ 'stocks ' => 'stocks ' ,
103+ 'salary ' => 'salary ' ,
104+ 'bar ' => 'bar ' ,
105+ 'preferences ' => 'preferences ' ,
106+ ],
107+ $ schema ['person ' ][SchemaInterface::COLUMNS ],
108+ );
109+ $ this ->assertCount (1 , $ schema ['person ' ][SchemaInterface::RELATIONS ]);
94110
95111 // Employee
96112 $ this ->assertArrayHasKey ('employee ' , $ schema );
97113 $ this ->assertCount (1 , $ schema ['employee ' ]);
98114 $ this ->assertSame (Employee::class, $ schema ['employee ' ][SchemaInterface::ENTITY ]);
99115 $ this ->assertNull ($ schema ['employee ' ][SchemaInterface::TABLE ] ?? null );
116+ $ this ->assertCount (0 , $ schema ['employee ' ][SchemaInterface::RELATIONS ] ?? []);
100117
101118 // Customer
102119 $ this ->assertArrayHasKey ('customer ' , $ schema );
103120 $ this ->assertCount (1 , $ schema ['customer ' ]);
104121 $ this ->assertSame (Customer::class, $ schema ['customer ' ][SchemaInterface::ENTITY ]);
105122 $ this ->assertNull ($ schema ['customer ' ][SchemaInterface::TABLE ] ?? null );
123+ $ this ->assertCount (0 , $ schema ['customer ' ][SchemaInterface::RELATIONS ] ?? []);
106124
107125 // Executive
108126 $ this ->assertSame ('employee ' , $ schema ['executive ' ][SchemaInterface::PARENT ]);
109127 $ this ->assertSame ('foo_id ' , $ schema ['executive ' ][SchemaInterface::PARENT_KEY ]);
110128 $ this ->assertSame ('executives ' , $ schema ['executive ' ][SchemaInterface::TABLE ]);
111- $ this ->assertSame (
129+ $ this ->assertEquals (
112130 [
113131 'bonus ' => 'bonus ' ,
114132 'proxyFieldWithAnnotation ' => 'proxy ' ,
115133 'foo_id ' => 'id ' ,
116134 'hidden ' => 'hidden ' ,
135+ 'added_tool_id ' => 'added_tool_id ' ,
117136 ],
118- $ schema ['executive ' ][SchemaInterface::COLUMNS ]
137+ $ schema ['executive ' ][SchemaInterface::COLUMNS ],
119138 );
139+ $ this ->assertCount (1 , $ schema ['executive ' ][SchemaInterface::RELATIONS ]);
140+
141+ // Executive2
142+ $ this ->assertSame ('executive ' , $ schema ['executive2 ' ][SchemaInterface::PARENT ]);
143+ $ this ->assertSame ('foo_id ' , $ schema ['executive2 ' ][SchemaInterface::PARENT_KEY ]);
144+ $ this ->assertEquals (['foo_id ' => 'id ' ], $ schema ['executive2 ' ][SchemaInterface::COLUMNS ]);
145+ $ this ->assertCount (0 , $ schema ['executive2 ' ][SchemaInterface::RELATIONS ]);
120146
121147 // Ceo
122148 $ this ->assertArrayHasKey ('ceo ' , $ schema );
123149 $ this ->assertCount (1 , $ schema ['ceo ' ]);
124150 $ this ->assertSame (Ceo::class, $ schema ['ceo ' ][SchemaInterface::ENTITY ]);
125151 $ this ->assertNull ($ schema ['ceo ' ][SchemaInterface::TABLE ] ?? null );
152+ $ this ->assertCount (0 , $ schema ['ceo ' ][SchemaInterface::RELATIONS ] ?? []);
126153
127154 // Beaver
128155 $ this ->assertEmpty ($ schema ['beaver ' ][SchemaInterface::DISCRIMINATOR ] ?? null );
@@ -137,6 +164,7 @@ public function testTableInheritance(ReaderInterface $reader): void
137164 'type ' => 'type ' ,
138165 'hidden ' => 'hidden ' ,
139166 ], $ schema ['beaver ' ][SchemaInterface::COLUMNS ]);
167+ $ this ->assertCount (1 , $ schema ['beaver ' ][SchemaInterface::RELATIONS ] ?? []);
140168 }
141169
142170 public function testTableInheritanceWithIncorrectClassesOrder (): void
0 commit comments