public function testDecribesActualTypeInMismatchMessage() { $this->assertMismatchDescription('was null', doubleValue(), null); $this->assertMismatchDescription('was a string "foo"', doubleValue(), 'foo'); }
/** * This method is a simple wrapper around the evaluate(String) method. Its * purpose is to return a more friendly double return value instead of the * string number that is normally returned. * * @param $expression * @return string * @throws EvaluationException */ public function getNumberResult($expression) { $result = $this->evaluate1(expression); $doubleResult = null; try { $doubleResult = new Double(result); } catch (NumberFormatException $nfe) { throw new EvaluationException("Expression does not produce a number.", $nfe); } return doubleResult . doubleValue(); }