1
0
mirror of synced 2025-01-19 23:11:41 +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 class SqlWalkerTest extends OrmTestCase
{ {
public function testGetSQLTableAlias() /**
* @dataProvider getColumnNamesAndSqlAliases
*/
public function testGetSQLTableAlias($tableName, $expectedAlias)
{ {
$query = new Query($this->_getTestEntityManager()); $query = new Query($this->_getTestEntityManager());
$sqlWalker = new SqlWalker($query, new ParserResult(), array()); $sqlWalker = new SqlWalker($query, new ParserResult(), array());
$this->assertSame('t0_', $sqlWalker->getSQLTableAlias('table')); $this->assertSame($expectedAlias, $sqlWalker->getSQLTableAlias($tableName));
$this->assertSame('t1_', $sqlWalker->getSQLTableAlias('çtable')); }
/**
* @private data provider
*
* @return string[][]
*/
public function getColumnNamesAndSqlAliases()
{
return array(
array('aaaaa', 'a0_'),
array('table', 't0_'),
array('çtable', 't0_'),
);
} }
} }