Started to reenable query language recognition tests.
This commit is contained in:
parent
a38a1f5188
commit
62779913c8
@ -124,7 +124,7 @@ abstract class AbstractResult
|
||||
public function getQueryComponent($componentAlias)
|
||||
{
|
||||
if ( ! isset($this->_queryComponents[$componentAlias])) {
|
||||
throw new Doctrine_ORM_Query_Exception('Unknown query component ' . $componentAlias);
|
||||
throw new \Doctrine\Common\DoctrineException('Unknown query component ' . $componentAlias);
|
||||
}
|
||||
|
||||
return $this->_queryComponents[$componentAlias];
|
||||
|
@ -1139,7 +1139,7 @@ class Parser
|
||||
default:
|
||||
$this->syntaxError();
|
||||
}
|
||||
throw new Doctrine_Exception("Not yet implemented.");
|
||||
throw new QueryException("Not yet implemented.");
|
||||
//TODO...
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
namespace Doctrine\ORM\Query;
|
||||
|
||||
use Doctrine\ORM\Query\AST;
|
||||
use Doctrine\Common\DoctrineException;
|
||||
|
||||
/**
|
||||
* The SqlWalker walks over an AST that represents a DQL query and constructs
|
||||
@ -379,9 +380,9 @@ class SqlWalker
|
||||
$sqlTableAlias = $this->_dqlToSqlAliasMap[$dqlAlias];
|
||||
$sql .= $sqlTableAlias . '.' . $class->getColumnName($fieldName);
|
||||
} else if ($pathExpr->isSimpleStateFieldAssociationPathExpression()) {
|
||||
throw new Doctrine_Exception("Not yet implemented.");
|
||||
throw new DoctrineException("Not yet implemented.");
|
||||
} else {
|
||||
throw new Doctrine_ORM_Query_Exception("Encountered invalid PathExpression during SQL construction.");
|
||||
throw new DoctrineException("Encountered invalid PathExpression during SQL construction.");
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ class AllTests
|
||||
|
||||
$suite->addTestSuite('Doctrine\Tests\ORM\Query\IdentifierRecognitionTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\ORM\Query\SelectSqlGenerationTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\ORM\Query\LanguageRecognitionTest');
|
||||
|
||||
/*
|
||||
$suite->addTestSuite('Doctrine\Tests\ORM\Query\LanguageRecognitionTest');
|
||||
$suite->addTestSuite('Orm_Query_ScannerTest');
|
||||
$suite->addTestSuite('Orm_Query_DqlGenerationTest');
|
||||
$suite->addTestSuite('Orm_Query_DeleteSqlGenerationTest');
|
||||
|
@ -15,10 +15,9 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
public function assertValidDql($dql, $debug = false)
|
||||
{
|
||||
try {
|
||||
$entityManager = $this->_em;
|
||||
$query = $entityManager->createQuery($dql);
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$parserResult = $query->parse();
|
||||
} catch (Doctrine_Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
if ($debug) {
|
||||
echo $e->getTraceAsString() . PHP_EOL;
|
||||
}
|
||||
@ -29,13 +28,12 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
public function assertInvalidDql($dql, $debug = false)
|
||||
{
|
||||
try {
|
||||
$entityManager = $this->_em;
|
||||
$query = $entityManager->createQuery($dql);
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setDql($dql);
|
||||
$parserResult = $query->parse();
|
||||
|
||||
$this->fail('No syntax errors were detected, when syntax errors were expected');
|
||||
} catch (Doctrine_Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
//echo $e->getMessage() . PHP_EOL;
|
||||
if ($debug) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
@ -50,13 +48,6 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
$this->assertInvalidDql('');
|
||||
}
|
||||
|
||||
public function testPlainFromClauseWithoutAlias()
|
||||
{
|
||||
$this->assertValidDql('SELECT * FROM Doctrine\Tests\Models\CMS\CmsUser');
|
||||
|
||||
$this->assertValidDql('SELECT id FROM Doctrine\Tests\Models\CMS\CmsUser');
|
||||
}
|
||||
|
||||
public function testPlainFromClauseWithAlias()
|
||||
{
|
||||
$this->assertValidDql('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u');
|
||||
@ -64,12 +55,12 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
|
||||
public function testSelectSingleComponentWithAsterisk()
|
||||
{
|
||||
$this->assertValidDql('SELECT u.* FROM Doctrine\Tests\Models\CMS\CmsUser u');
|
||||
$this->assertValidDql('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u');
|
||||
}
|
||||
|
||||
public function testInvalidSelectSingleComponentWithAsterisk()
|
||||
{
|
||||
$this->assertInvalidDql('SELECT p.* FROM Doctrine\Tests\Models\CMS\CmsUser u');
|
||||
$this->assertInvalidDql('SELECT p FROM Doctrine\Tests\Models\CMS\CmsUser u');
|
||||
}
|
||||
|
||||
public function testSelectSingleComponentWithMultipleColumns()
|
||||
@ -79,7 +70,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
|
||||
public function testSelectMultipleComponentsWithAsterisk()
|
||||
{
|
||||
$this->assertValidDql('SELECT u.*, p.* FROM Doctrine\Tests\Models\CMS\CmsUser u, u.phonenumbers p');
|
||||
$this->assertValidDql('SELECT u, p FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.phonenumbers p');
|
||||
}
|
||||
|
||||
public function testSelectDistinctIsSupported()
|
||||
@ -96,30 +87,30 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
$this->assertValidDql('SELECT COUNT(DISTINCT u.name) FROM Doctrine\Tests\Models\CMS\CmsUser u');
|
||||
}
|
||||
|
||||
/*
|
||||
public function testFunctionalExpressionsSupportedInWherePart()
|
||||
{
|
||||
$this->assertValidDql("SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE TRIM(u.name) = 'someone'");
|
||||
}
|
||||
|
||||
*/
|
||||
public function testArithmeticExpressionsSupportedInWherePart()
|
||||
{
|
||||
$this->assertValidDql('SELECT u.* FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE ((u.id + 5000) * u.id + 3) < 10000000');
|
||||
$this->assertValidDql('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE ((u.id + 5000) * u.id + 3) < 10000000');
|
||||
}
|
||||
|
||||
/*
|
||||
public function testInExpressionSupportedInWherePart()
|
||||
{
|
||||
$this->assertValidDql('SELECT * FROM Doctrine\Tests\Models\CMS\CmsUser WHERE CmsUser.id IN (1, 2)');
|
||||
$this->assertValidDql('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN (1, 2)');
|
||||
}
|
||||
|
||||
public function testNotInExpressionSupportedInWherePart()
|
||||
{
|
||||
$this->assertValidDql('SELECT * FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT IN (1)');
|
||||
$this->assertValidDql('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT IN (1)');
|
||||
}
|
||||
|
||||
public function testExistsExpressionSupportedInWherePart()
|
||||
*/
|
||||
/*public function testExistsExpressionSupportedInWherePart()
|
||||
{
|
||||
$this->assertValidDql('SELECT u.* FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE EXISTS (SELECT p.user_id FROM Doctrine\Tests\Models\CMS\CmsPhonenumber p WHERE p.user_id = u.id)');
|
||||
$this->assertValidDql('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE EXISTS (SELECT p.user_id FROM Doctrine\Tests\Models\CMS\CmsPhonenumber p WHERE p.user_id = u.id)');
|
||||
}
|
||||
|
||||
public function testNotExistsExpressionSupportedInWherePart()
|
||||
@ -261,7 +252,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
public function testOrderByWithFunctionExpression()
|
||||
{
|
||||
$this->assertValidDql('SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u ORDER BY COALESCE(u.id, u.name) DESC');
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
public function testSubselectInInExpression()
|
||||
{
|
||||
@ -273,7 +264,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
// Semantical error: Unknown query component u (probably in subselect)
|
||||
$this->assertValidDql("SELECT u.name, (SELECT COUNT(p.phonenumber) FROM CmsPhonenumber p WHERE p.user_id = u.id) pcount FROM CmsUser u WHERE u.name = 'zYne' LIMIT 1");
|
||||
}
|
||||
*/
|
||||
*//*
|
||||
public function testPositionalInputParameter()
|
||||
{
|
||||
$this->assertValidDql('SELECT * FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?');
|
||||
@ -282,7 +273,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
public function testNamedInputParameter()
|
||||
{
|
||||
$this->assertValidDql('SELECT * FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :id');
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
public function testCustomJoinsAndWithKeywordSupported()
|
||||
{
|
||||
@ -290,7 +281,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
$this->assertValidDql('SELECT c.*, c2.*, d.* FROM Record_Country c INNER JOIN c.City c2 WITH c2.id = 2 WHERE c.id = 1');
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public function testJoinConditionsSupported()
|
||||
{
|
||||
$this->assertValidDql("SELECT u.name, p.* FROM Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.phonenumbers p ON p.phonenumber = '123 123'");
|
||||
@ -320,7 +311,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
$this->assertValidDql("SELECT * FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name NOT BETWEEN 'jepso' AND 'zYne'");
|
||||
}
|
||||
|
||||
*/
|
||||
/* public function testAllExpressionWithCorrelatedSubquery()
|
||||
{
|
||||
// We need existant classes here, otherwise semantical will always fail
|
||||
@ -338,7 +329,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
// We need existant classes here, otherwise semantical will always fail
|
||||
$this->assertValidDql('SELECT * FROM Employee e WHERE e.salary > SOME (SELECT m.salary FROM Manager m WHERE m.department = e.department)');
|
||||
}
|
||||
*/
|
||||
*//*
|
||||
public function testLikeExpression()
|
||||
{
|
||||
$this->assertValidDql("SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name LIKE 'z%'");
|
||||
@ -353,7 +344,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
$this->assertValidDql("SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name LIKE 'z|%' ESCAPE '|'");
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* TODO: Hydration can't deal with this currently but it should be allowed.
|
||||
* Also, generated SQL looks like: "... FROM cms_user, cms_article ..." which
|
||||
@ -362,7 +353,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
* The main use case for this generalized style of join is when a join condition
|
||||
* does not involve a foreign key relationship that is mapped to an entity relationship.
|
||||
*/
|
||||
public function testImplicitJoinWithCartesianProductAndConditionInWhere()
|
||||
/* public function testImplicitJoinWithCartesianProductAndConditionInWhere()
|
||||
{
|
||||
$this->assertValidDql("SELECT u.*, a.* FROM Doctrine\Tests\Models\CMS\CmsUser u, CmsArticle a WHERE u.name = a.topic");
|
||||
}
|
||||
@ -395,5 +386,5 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
|
||||
|
||||
// Currently UNDEFINED OFFSET error
|
||||
//$this->assertInvalidDql("SELECT * FROM CmsUser.articles.comments");
|
||||
}
|
||||
}*/
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user