public function getIndex() { try { $index = $this->table->getIndexByName($this->name); } catch (SchemaException $e) { $index = $this->table->getIndexByName($this->fKeyName); } return $index; }
/** * @covers \Kicaj\Schema\Database\MySQL\Index::getColumns */ public function test_index_getColumns() { // Given $table = new Table($this->getFixtureRawData('table1.sql'), $this->getMock(DatabaseItf::class)); // When $index = $table->getIndexByName('rel13'); $columns = $index->getColumns(); // Then $this->assertSame(1, count($columns)); $this->assertTrue(array_key_exists('f2', $columns)); $this->assertSame('f2', $columns['f2']->getName()); }