public function testGetFkName() { $expectedTableName = 'tablename'; $modelEntity = $this->prepareTableName($expectedTableName, false); $columnName = 'columnName'; $this->_connection->expects($this->once())->method('getForeignKeyName')->with($expectedTableName, $columnName, $expectedTableName, $columnName)->will($this->returnValue('fkName')); $this->assertEquals('fkName', $this->_resorce->getFkName($modelEntity, $columnName, $modelEntity, $columnName)); }
public function testGetFkName() { $table = 'table'; $calculatedTableName = self::TABLE_PREFIX . 'table'; $refTable = 'ref_table'; $calculatedRefTableName = self::TABLE_PREFIX . 'ref_table'; $columnName = 'columnName'; $refColumnName = 'refColumnName'; $this->connection->expects($this->once())->method('getForeignKeyName')->with($calculatedTableName, $columnName, $calculatedRefTableName, $refColumnName)->will($this->returnValue('fkName')); $this->_connectionFactory->expects($this->once())->method('create')->will($this->returnValue($this->connection)); $this->assertEquals('fkName', $this->resource->getFkName($table, $columnName, $refTable, $refColumnName)); }
/** * Retrieve 32bit UNIQUE HASH for a Table foreign key * * @param string $priTableName the target table name * @param string $priColumnName the target table column name * @param string $refTableName the reference table name * @param string $refColumnName the reference table column name * @return string */ public function getFkName($priTableName, $priColumnName, $refTableName, $refColumnName) { return $this->_resourceModel->getFkName($priTableName, $priColumnName, $refTableName, $refColumnName); }