public function test_conditionNotEqual_varEqual()
 {
     /* Prepare test mocks and data */
     $cond = new Condition();
     $cond->setVar('VAR');
     $cond->setOperation(Condition::OPER_NEQ);
     $cond->setValue('value');
     /* Create object and perform testing action. */
     $obj = new ConditionValidator();
     $res = $obj->isValid($cond, ['VAR' => 'value']);
     $this->assertFalse($res);
 }
 /**
  * Validate condition using template variables.
  *
  * @param Condition $condition
  *
  * @return bool
  */
 public function isValid(Condition $condition, $vars)
 {
     $result = false;
     $name = $condition->getVar();
     $oper = $condition->getOperation();
     $value = (string) $condition->getValue();
     if (isset($vars[$name])) {
         $var = (string) $vars[$name];
         switch ($oper) {
             case Condition::OPER_EQ:
                 $result = strcmp($var, $value) == 0;
                 break;
             case Condition::OPER_NEQ:
                 $result = strcmp($var, $value) != 0;
                 break;
         }
     }
     return $result;
 }