aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--tests/MathTest.php8
2 files changed, 11 insertions, 1 deletions
diff --git a/README.md b/README.md
index 81d9475..4863224 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,8 @@ $executor->addFunction('abs', function($arg) {return abs($arg);});
```
Function default parameters are not supported at this time.
+Default parameters are not currently supported.
+
## Operators:
Default operators: `+ - * / ^`
@@ -112,7 +114,7 @@ Default variables:
```
$pi = 3.14159265359
-$e = 2.71828182846
+$e = 2.71828182846
```
You can add your own variables to executor:
diff --git a/tests/MathTest.php b/tests/MathTest.php
index 3cf4dbd..eba32c0 100644
--- a/tests/MathTest.php
+++ b/tests/MathTest.php
@@ -166,6 +166,14 @@ class MathTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($phpResult, $calculator->execute($expression));
}
+ public function testFunctionsWithQuotes()
+ {
+ $calculator = new MathExecutor();
+ $calculator->addFunction('concat', function($first, $second){return $first.$second;});
+ $this->assertEquals('testing', $calculator->execute('concat("test", "ing")'));
+ $this->assertEquals('testing', $calculator->execute("concat('test', 'ing')"));
+ }
+
public function testQuotes()
{
$calculator = new MathExecutor();