Skip to content

Commit

Permalink
Dev: Add new expression test for '' >= ' '
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt authored and LouisGac committed Aug 28, 2017
1 parent 2a8f23b commit 0c9d4e1
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions tests/helpers/ExpressionCoreHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ public function notes()

}

/**
*
*/
public function testCompareEmptyNumberAndEmptyString()
{
$sgqa = '563168X136X5376';

$expression = '((563168X136X5376.NAOK >= " "))';

$value = '';

$this->compareExpression($sgqa, $value, $expression);
}

/**
* When constructing condition, empty string is represented
* as "No answer".
Expand All @@ -71,8 +85,22 @@ public function testCompareNumberAndEmptyString()
{
$sgqa = '563168X136X5376';

$expression = '((563168X136X5376.NAOK >= " "))';

$value = '3';

$this->compareExpression($sgqa, $value, $expression);
}

/**
* @param string $sgqa
* @param string $expression
* @return void
*/
protected function compareExpression($sgqa, $value, $expression)
{
// Input value 3.
$_SESSION['survey_563168'][$sgqa] = '3';
$_SESSION['survey_563168'][$sgqa] = $value;

$em = new \ExpressionManager();
$limeEm = \LimeExpressionManager::singleton();
Expand All @@ -81,13 +109,12 @@ public function testCompareNumberAndEmptyString()
[
$sgqa => [
'sgqa' => $sgqa,
'type' => 'N'
'type' => 'N',
//'jsName' => 'anything' This will trigger LEMval()
]
]
);

$expression = '((563168X136X5376.NAOK >= " "))';

$em->RDP_Evaluate($expression);

$result = $em->GetResult();
Expand Down

0 comments on commit 0c9d4e1

Please sign in to comment.