fix DDC-2205
This commit is contained in:
parent
4bbfe0ce8a
commit
2104ae9935
@ -1792,6 +1792,9 @@ class Parser
|
||||
switch (true) {
|
||||
case ($lookahead === Lexer::T_INTEGER):
|
||||
case ($lookahead === Lexer::T_FLOAT):
|
||||
// SimpleArithmeticExpression : (- u.value ) or ( + u.value ) or ( - 1 ) or ( + 1 )
|
||||
case ($lookahead === Lexer::T_MINUS):
|
||||
case ($lookahead === Lexer::T_PLUS):
|
||||
return $this->SimpleArithmeticExpression();
|
||||
|
||||
case ($lookahead === Lexer::T_STRING):
|
||||
|
@ -1230,6 +1230,37 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-2205
|
||||
*/
|
||||
public function testCaseNegativeValuesInThenExpression()
|
||||
{
|
||||
$this->assertSqlGeneration(
|
||||
"SELECT CASE g.name WHEN 'admin' THEN - 1 ELSE - 2 END FROM Doctrine\Tests\Models\CMS\CmsGroup g",
|
||||
"SELECT CASE c0_.name WHEN 'admin' THEN -1 ELSE -2 END AS sclr0 FROM cms_groups c0_"
|
||||
);
|
||||
|
||||
$this->assertSqlGeneration(
|
||||
"SELECT CASE g.name WHEN 'admin' THEN - 2 WHEN 'guest' THEN - 1 ELSE 0 END FROM Doctrine\Tests\Models\CMS\CmsGroup g",
|
||||
"SELECT CASE c0_.name WHEN 'admin' THEN -2 WHEN 'guest' THEN -1 ELSE 0 END AS sclr0 FROM cms_groups c0_"
|
||||
);
|
||||
|
||||
$this->assertSqlGeneration(
|
||||
"SELECT CASE g.name WHEN 'admin' THEN (- 1) ELSE (- 2) END FROM Doctrine\Tests\Models\CMS\CmsGroup g",
|
||||
"SELECT CASE c0_.name WHEN 'admin' THEN -1 ELSE -2 END AS sclr0 FROM cms_groups c0_"
|
||||
);
|
||||
|
||||
$this->assertSqlGeneration(
|
||||
"SELECT CASE g.name WHEN 'admin' THEN ( - :value) ELSE ( + :value) END FROM Doctrine\Tests\Models\CMS\CmsGroup g",
|
||||
"SELECT CASE c0_.name WHEN 'admin' THEN -? ELSE +? END AS sclr0 FROM cms_groups c0_"
|
||||
);
|
||||
|
||||
$this->assertSqlGeneration(
|
||||
"SELECT CASE g.name WHEN 'admin' THEN ( - g.id) ELSE ( + g.id) END FROM Doctrine\Tests\Models\CMS\CmsGroup g",
|
||||
"SELECT CASE c0_.name WHEN 'admin' THEN -c0_.id ELSE +c0_.id END AS sclr0 FROM cms_groups c0_"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1339
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user