1
0
mirror of synced 2025-01-19 15:01:40 +03:00

#615 - Using a data provider to build aliases for the SqlWalkerTest

This commit is contained in:
Marco Pivetta 2014-10-19 17:16:07 +02:00
parent 17c9388473
commit 10da2eb85b

View File

@ -14,12 +14,28 @@ use Doctrine\ORM\Query\ParserResult;
*/
class SqlWalkerTest extends OrmTestCase
{
public function testGetSQLTableAlias()
/**
* @dataProvider getColumnNamesAndSqlAliases
*/
public function testGetSQLTableAlias($tableName, $expectedAlias)
{
$query = new Query($this->_getTestEntityManager());
$sqlWalker = new SqlWalker($query, new ParserResult(), array());
$this->assertSame('t0_', $sqlWalker->getSQLTableAlias('table'));
$this->assertSame('t1_', $sqlWalker->getSQLTableAlias('çtable'));
$this->assertSame($expectedAlias, $sqlWalker->getSQLTableAlias($tableName));
}
/**
* @private data provider
*
* @return string[][]
*/
public function getColumnNamesAndSqlAliases()
{
return array(
array('aaaaa', 'a0_'),
array('table', 't0_'),
array('çtable', 't0_'),
);
}
}