@@ 116-134 (lines=19) @@ | ||
113 | $this->assertSame('foo', $column->getDbalColumn()->getName()); |
|
114 | } |
|
115 | ||
116 | public function testReference() |
|
117 | { |
|
118 | $schema = new Schema(); |
|
119 | $fluid = new TdbmFluidSchema($schema); |
|
120 | ||
121 | $countries = $fluid->table('countries'); |
|
122 | $countries->id(); |
|
123 | ||
124 | $users = $fluid->table('users'); |
|
125 | $users->column('country_id')->references('countries', 'myfk'); |
|
126 | ||
127 | $dbalColumn = $schema->getTable('users')->getColumn('country_id'); |
|
128 | ||
129 | $this->assertSame(Type::getType(Type::INTEGER), $dbalColumn->getType()); |
|
130 | $fk = $schema->getTable('users')->getForeignKey('myfk'); |
|
131 | $this->assertSame('users', $fk->getLocalTableName()); |
|
132 | $this->assertSame('countries', $fk->getForeignTableName()); |
|
133 | $this->assertSame(['country_id'], $fk->getLocalColumns()); |
|
134 | } |
|
135 | ||
136 | public function testReferenceException() |
|
137 | { |
@@ 193-212 (lines=20) @@ | ||
190 | } |
|
191 | } |
|
192 | ||
193 | public function testInherits() |
|
194 | { |
|
195 | $schema = new Schema(); |
|
196 | $fluid = new TdbmFluidSchema($schema); |
|
197 | ||
198 | $contacts = $fluid->table('contacts'); |
|
199 | $contacts->id(); |
|
200 | ||
201 | $fluid->table('users')->extends('contacts'); |
|
202 | ||
203 | $dbalColumn = $schema->getTable('users')->getColumn('id'); |
|
204 | ||
205 | $this->assertSame(Type::getType(Type::INTEGER), $dbalColumn->getType()); |
|
206 | $fks = $schema->getTable('users')->getForeignKeys(); |
|
207 | $this->assertCount(1, $fks); |
|
208 | $fk = array_pop($fks); |
|
209 | $this->assertSame('users', $fk->getLocalTableName()); |
|
210 | $this->assertSame('contacts', $fk->getForeignTableName()); |
|
211 | $this->assertSame(['id'], $fk->getLocalColumns()); |
|
212 | } |
|
213 | ||
214 | public function testGetDbalTable() |
|
215 | { |