@@ 131-147 (lines=17) @@ | ||
128 | /** |
|
129 | * @group DDC-3671 |
|
130 | */ |
|
131 | public function testSchemaHasProperIndexesFromUniqueConstraintAnnotation() |
|
132 | { |
|
133 | $em = $this->_getTestEntityManager(); |
|
134 | $schemaTool = new SchemaTool($em); |
|
135 | $classes = [ |
|
136 | $em->getClassMetadata(UniqueConstraintAnnotationModel::class), |
|
137 | ]; |
|
138 | ||
139 | $schema = $schemaTool->getSchemaFromMetadata($classes); |
|
140 | ||
141 | $this->assertTrue($schema->hasTable('unique_constraint_annotation_table')); |
|
142 | $table = $schema->getTable('unique_constraint_annotation_table'); |
|
143 | ||
144 | $this->assertEquals(2, count($table->getIndexes())); |
|
145 | $this->assertTrue($table->hasIndex('primary')); |
|
146 | $this->assertTrue($table->hasIndex('uniq_hash')); |
|
147 | } |
|
148 | ||
149 | public function testRemoveUniqueIndexOverruledByPrimaryKey() |
|
150 | { |
|
@@ 149-166 (lines=18) @@ | ||
146 | $this->assertTrue($table->hasIndex('uniq_hash')); |
|
147 | } |
|
148 | ||
149 | public function testRemoveUniqueIndexOverruledByPrimaryKey() |
|
150 | { |
|
151 | $em = $this->_getTestEntityManager(); |
|
152 | $schemaTool = new SchemaTool($em); |
|
153 | $classes = [ |
|
154 | $em->getClassMetadata(FirstEntity::class), |
|
155 | $em->getClassMetadata(SecondEntity::class) |
|
156 | ]; |
|
157 | ||
158 | $schema = $schemaTool->getSchemaFromMetadata($classes); |
|
159 | ||
160 | $this->assertTrue($schema->hasTable('first_entity'), "Table first_entity should exist."); |
|
161 | ||
162 | $indexes = $schema->getTable('first_entity')->getIndexes(); |
|
163 | ||
164 | $this->assertCount(1, $indexes, "there should be only one index"); |
|
165 | $this->assertTrue(current($indexes)->isPrimary(), "index should be primary"); |
|
166 | } |
|
167 | ||
168 | public function testSetDiscriminatorColumnWithoutLength() : void |
|
169 | { |