diff --git a/tests/unit/Espo/Core/Formula/EvaluatorTest.php b/tests/unit/Espo/Core/Formula/EvaluatorTest.php index 5cf20af2b4..1119bebd19 100644 --- a/tests/unit/Espo/Core/Formula/EvaluatorTest.php +++ b/tests/unit/Espo/Core/Formula/EvaluatorTest.php @@ -38,6 +38,11 @@ use tests\unit\ContainerMocker; class EvaluatorTest extends \PHPUnit\Framework\TestCase { + /** + * @var Evaluator + */ + private $evaluator; + protected function setUp() : void { $log = $this->getMockBuilder(Log::class)->disableOriginalConstructor()->getMock(); @@ -488,4 +493,26 @@ class EvaluatorTest extends \PHPUnit\Framework\TestCase $this->assertEquals(124 % 5, $actual); } + + function testParentheses1() + { + $expression = " + \$test = 1; + + ifThen( + true, + ( + \$hello = 2; + \$test = \$hello; + ) + ); + "; + + $vars = (object) []; + + $this->evaluator->process($expression, null, $vars); + + $this->assertEquals(2, $vars->test); + + } }