From fa935b0af637fbda34454aa679c69eaaaba1308d Mon Sep 17 00:00:00 2001 From: Alexander Kiryukhin Date: Fri, 1 Apr 2016 17:24:34 +0300 Subject: [PATCH] + Test for division by zero --- tests/MathTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/MathTest.php b/tests/MathTest.php index 1b96ee2..f8a271e 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -27,6 +27,12 @@ class MathTest extends \PHPUnit_Framework_TestCase $this->assertEquals($calculator->execute($expression), $phpResult); } + public function testZeroDevision() + { + $calculator = new MathExecutor(); + $this->assertEquals($calculator->execute('1 / 0'), 0); + } + /** * Expressions data provider */ @@ -62,4 +68,4 @@ class MathTest extends \PHPUnit_Framework_TestCase array('100500 * 3.5E-5') ); } -} \ No newline at end of file +}