From 10da2eb85b874fec7b6aa6a3ac11350a63db5103 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sun, 19 Oct 2014 17:16:07 +0200 Subject: [PATCH] #615 - Using a data provider to build aliases for the SqlWalkerTest --- .../Tests/ORM/Query/SqlWalkerTest.php | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Query/SqlWalkerTest.php b/tests/Doctrine/Tests/ORM/Query/SqlWalkerTest.php index 6d9d3e257..d057fc8e0 100644 --- a/tests/Doctrine/Tests/ORM/Query/SqlWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SqlWalkerTest.php @@ -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_'), + ); } }