Commit d1e9309a authored by Morton Jonuschat's avatar Morton Jonuschat Committed by Anja Leichsenring
Browse files

[BUGFIX] dbal: make admin_get_tables() return correct table information

Return the table information in the documented format (array with
tablenames as key and arrays with status information as value).

Resolves: #67067
Releases: master, 6.2
Change-Id: I7a35c5cfdaa469c407f5c4e4f80b55625034be91
Reviewed-on: http://review.typo3.org/39637


Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 8e831a0d
......@@ -2585,7 +2585,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
// Skip tables from the Oracle 10 Recycle Bin
continue;
}
$whichTables[$theTable] = $theTable;
$whichTables[$theTable] = array('Name' => $theTable);
}
}
break;
......@@ -2607,6 +2607,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
foreach ($whichTables as $tN => $tDefinition) {
if (isset($tMap[$tN])) {
$tN = $tMap[$tN];
$tDefinition = array('Name' => $tN);
}
$newList[$tN] = $tDefinition;
}
......@@ -2615,7 +2616,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
// Adding tables configured to reside in other DBMS (handler by other handlers than the default):
if (is_array($this->table2handlerKeys)) {
foreach ($this->table2handlerKeys as $key => $handlerKey) {
$whichTables[$key] = $key;
$whichTables[$key] = array('Name' => $key);
}
}
return $whichTables;
......
......@@ -315,6 +315,20 @@ class DatabaseConnectionOracleTest extends AbstractTestCase {
$this->assertEquals($expected, $this->cleanSql($result));
}
/**
* @test
* @see https://forge.typo3.org/issues/67067
*/
public function tablesAreUnmappedInAdminGetTables() {
$handlerMock = $this->getMock('\ADODB_mock', array('MetaTables'), array(), '', FALSE);
$handlerMock->expects($this->any())->method('MetaTables')->will($this->returnValue(array('cf_cache_hash')));
$this->subject->handlerInstance['_DEFAULT'] = $handlerMock;
$actual = $this->subject->admin_get_tables();
$expected = array('cachingframework_cache_hash' => array('Name' => 'cachingframework_cache_hash'));
$this->assertSame($expected, $actual);
}
/**
* @test
* @see http://forge.typo3.org/issues/17918
......
......@@ -114,6 +114,21 @@ class DatabaseConnectionTest extends AbstractTestCase {
$this->assertEquals('cf_cache_hash', $cfCacheHashNeedsMapping[0]['table']);
}
/**
* @test
* @see https://forge.typo3.org/issues/67067
*/
public function adminGetTablesReturnsArrayWithNameKey() {
$handlerMock = $this->getMock('\ADODB_mock', array('MetaTables'), array(), '', FALSE);
$handlerMock->expects($this->any())->method('MetaTables')->will($this->returnValue(array('cf_cache_hash')));
$this->subject->handlerCfg['_DEFAULT']['type'] = 'adodb';
$this->subject->handlerInstance['_DEFAULT'] = $handlerMock;
$actual = $this->subject->admin_get_tables();
$expected = array('cf_cache_hash' => array('Name' => 'cf_cache_hash'));
$this->assertSame($expected, $actual);
}
/**
* @test
* @see http://forge.typo3.org/issues/21502
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment