2013-03-18 14:10:14 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM\Query;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Query\SqlWalker;
|
|
|
|
use Doctrine\ORM\Query;
|
|
|
|
use Doctrine\Tests\OrmTestCase;
|
|
|
|
use Doctrine\ORM\Query\ParserResult;
|
|
|
|
|
2014-10-19 19:10:39 +04:00
|
|
|
/**
|
|
|
|
* Tests for {@see \Doctrine\ORM\Query\SqlWalker}
|
|
|
|
*
|
|
|
|
* @covers \Doctrine\ORM\Query\SqlWalker
|
|
|
|
*/
|
2013-03-18 14:10:14 +04:00
|
|
|
class SqlWalkerTest extends OrmTestCase
|
|
|
|
{
|
2014-10-19 19:16:07 +04:00
|
|
|
/**
|
|
|
|
* @dataProvider getColumnNamesAndSqlAliases
|
|
|
|
*/
|
|
|
|
public function testGetSQLTableAlias($tableName, $expectedAlias)
|
2013-03-18 14:10:14 +04:00
|
|
|
{
|
2014-10-19 19:09:27 +04:00
|
|
|
$query = new Query($this->_getTestEntityManager());
|
2013-03-18 14:10:14 +04:00
|
|
|
$sqlWalker = new SqlWalker($query, new ParserResult(), array());
|
|
|
|
|
2014-10-19 19:16:07 +04:00
|
|
|
$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_'),
|
|
|
|
);
|
2013-03-18 14:10:14 +04:00
|
|
|
}
|
2014-10-19 19:09:41 +04:00
|
|
|
}
|