Skip to content

Commit

Permalink
Dev: Include param onlynum in test function
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt authored and LouisGac committed Aug 28, 2017
1 parent 40df2b9 commit 52329c9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/helpers/ExpressionCoreHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public function testCompareNumberLtSpace()

/**
* Expression: '3' < 'A'
* @group me
*/
public function testCompareNumberLtLetter()
{
Expand Down Expand Up @@ -293,9 +294,10 @@ public function testCompareNumberPlusNumber()
* @param string $sgqa
* @param string $expression
* @param boolean $jsonEncode If true, run json_encode on PHP eval result. Good for when node returns boolean.
* @param boolean $onlynum If 1, makes LEMval() return number.
* @return void
*/
protected function compareExpression($sgqa, $value, $expression, $jsonEncode = true)
protected function compareExpression($sgqa, $value, $expression, $jsonEncode = true, $onlynum = 1)
{
// Input value 3.
$_SESSION['survey_563168'][$sgqa] = $value;
Expand Down Expand Up @@ -323,14 +325,14 @@ protected function compareExpression($sgqa, $value, $expression, $jsonEncode = t

$errors = $em->RDP_GetErrors();
$this->assertEmpty($errors);
$js = $em->GetJavaScriptEquivalentOfExpression();
$jsOfExpression = $em->GetJavaScriptEquivalentOfExpression();

$js = $this->getDummyNodeSetup($sgqa, $value, null, 0) . $js;
$js = $this->getDummyNodeSetup($sgqa, $value, null, $onlynum) . $jsOfExpression;

$nodeOutput = $this->runNode($js);

$this->assertCount(1, $nodeOutput);
$this->assertEquals($result, $nodeOutput[0], 'JS and PHP must return same result');
$this->assertEquals($result, $nodeOutput[0], 'JS and PHP must return same result: ' . $expression);
}

/**
Expand Down

0 comments on commit 52329c9

Please sign in to comment.