-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15686 from BeMySlaveDarlin/issue/15553-fix-return…
…-type #15553 - Fix Query::getExpression return type
- Loading branch information
Showing
3 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Phalcon Framework. | ||
* | ||
* (c) Phalcon Team <team@phalcon.io> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phalcon\Test\Unit\Mvc\Model\Query; | ||
|
||
use Phalcon\Mvc\Model\Query; | ||
use UnitTester; | ||
|
||
class GetExpressionCest | ||
{ | ||
private $PHQL_T_AND = 266; | ||
private $PHQL_T_OR = 267; | ||
|
||
/** | ||
* Tests Phalcon\Mvc\Model\Query :: getExpression() | ||
* | ||
* @author Phalcon Team <team@phalcon.io> | ||
* @since 2021-09-21 | ||
* @issue 15553 | ||
*/ | ||
public function mvcModelQueryGetExpression(UnitTester $I) | ||
{ | ||
$I->wantToTest('Phalcon\Mvc\Model\Query - getExpression()'); | ||
|
||
$valueOne = [ | ||
'type' => 'binary-op', | ||
'op' => 'AND', | ||
'left' => null, | ||
'right' => null, | ||
]; | ||
$valueTwo = [ | ||
'type' => 'binary-op', | ||
'op' => 'OR', | ||
'left' => null, | ||
'right' => null, | ||
]; | ||
|
||
$oneExpr = [ | ||
'type' => $this->PHQL_T_AND, | ||
]; | ||
|
||
$twoExpr = [ | ||
'type' => $this->PHQL_T_OR, | ||
]; | ||
|
||
$query = new Query(); | ||
$reflection = new \ReflectionClass(Query::class); | ||
$getExpression = $reflection->getMethod('getExpression'); | ||
$getExpression->setAccessible(true); | ||
|
||
$I->assertEquals($getExpression->invokeArgs($query, [$oneExpr, false]), $valueOne); | ||
$I->assertEquals($getExpression->invokeArgs($query, [$twoExpr, false]), $valueTwo); | ||
} | ||
} |