Commit 1b3c36b4 authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2702 from asgrim/filter-tablenames-in-db2-schema-manager

Added missing filtering of table name assets in DB2SchemaManager
parents 0061022d 31195d92
......@@ -41,7 +41,7 @@ class DB2SchemaManager extends AbstractSchemaManager
$tables = $this->_conn->fetchAll($sql);
return $this->_getPortableTablesList($tables);
return $this->filterAssetNames($this->_getPortableTablesList($tables));
}
/**
......
<?php
namespace Doctrine\Tests\DBAL\Schema;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Schema\DB2SchemaManager;
/**
* @covers \Doctrine\DBAL\Schema\DB2SchemaManager
*/
final class DB2SchemaManagerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Connection|\PHPUnit_Framework_MockObject_MockObject
*/
private $conn;
/**
* @var DB2SchemaManager
*/
private $manager;
protected function setUp()
{
$eventManager = new EventManager();
$driverMock = $this->getMock(Driver::class);
$platform = $this->getMock(DB2Platform::class);
$this->conn = $this->getMock(
Connection::class,
['fetchAll'],
[['platform' => $platform], $driverMock, new Configuration(), $eventManager]
);
$this->manager = new DB2SchemaManager($this->conn);
}
/**
* @group DBAL-2701
* @see https://github.com/doctrine/dbal/issues/2701
* @return void
*/
public function testListTableNamesFiltersAssetNamesCorrectly()
{
$this->conn->getConfiguration()->setFilterSchemaAssetsExpression('/^(?!T_)/');
$this->conn->expects($this->once())->method('fetchAll')->will($this->returnValue([
[
'name' => 'FOO',
],
[
'name' => 'T_FOO',
],
[
'name' => 'BAR',
],
[
'name' => 'T_BAR',
],
]));
$this->assertSame(
[
'FOO',
'BAR',
],
$this->manager->listTableNames()
);
}
}
Markdown is supported
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