#615 - Using a data provider to build aliases for the SqlWalkerTest
This commit is contained in:
parent
17c9388473
commit
10da2eb85b
@ -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_'),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user