formula test

This commit is contained in:
Yuri Kuznetsov
2021-05-28 15:15:26 +03:00
parent 738cae727e
commit 700a39f4c5
@@ -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);
}
}