diff options
author | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2020-06-01 03:50:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 03:50:39 +0300 |
commit | ea898d7a7b85aeb677f81f13784232c99b61808a (patch) | |
tree | a1f6985aa44e3af0296989435427d57bc5219add /tests | |
parent | 7852fc7d04bcdb3aa60384a1f6dddfd637fedd70 (diff) |
Code style fixes & Github Actions (#65)V2.0.2
* Code style fixes
Up phpunit to v8
New CI
* Remove travis
* Fix CI badge
* Added php-cs-fixer action
Diffstat (limited to 'tests')
-rw-r--r-- | tests/MathTest.php | 33 | ||||
-rw-r--r-- | tests/bootstrap.php | 4 |
2 files changed, 24 insertions, 13 deletions
diff --git a/tests/MathTest.php b/tests/MathTest.php index 39ac649..6108bd8 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -12,7 +12,6 @@ namespace NXP\Tests; use Exception; -use NXP\Classes\Operator; use NXP\Exception\DivisionByZeroException; use NXP\Exception\IncorrectExpressionException; use NXP\Exception\UnknownFunctionException; @@ -267,27 +266,37 @@ class MathTest extends TestCase { $calculator = new MathExecutor(); $this->assertEquals(30, $calculator->execute( - 'if(100 > 99, 30, 0)')); + 'if(100 > 99, 30, 0)' + )); $this->assertEquals(0, $calculator->execute( - 'if(100 < 99, 30, 0)')); + 'if(100 < 99, 30, 0)' + )); $this->assertEquals(30, $calculator->execute( - 'if(98 < 99 && sin(1) < 1, 30, 0)')); + 'if(98 < 99 && sin(1) < 1, 30, 0)' + )); $this->assertEquals(40, $calculator->execute( - 'if(98 < 99 && sin(1) < 1, max(30, 40), 0)')); + 'if(98 < 99 && sin(1) < 1, max(30, 40), 0)' + )); $this->assertEquals(40, $calculator->execute( - 'if(98 < 99 && sin(1) < 1, if(10 > 5, max(30, 40), 1), 0)')); + 'if(98 < 99 && sin(1) < 1, if(10 > 5, max(30, 40), 1), 0)' + )); $this->assertEquals(20, $calculator->execute( - 'if(98 < 99 && sin(1) > 1, if(10 > 5, max(30, 40), 1), if(4 <= 4, 20, 21))')); + 'if(98 < 99 && sin(1) > 1, if(10 > 5, max(30, 40), 1), if(4 <= 4, 20, 21))' + )); $this->assertEquals(cos(2), $calculator->execute( - 'if(98 < 99 && sin(1) >= 1, max(30, 40), cos(2))')); + 'if(98 < 99 && sin(1) >= 1, max(30, 40), cos(2))' + )); $this->assertEquals(cos(2), $calculator->execute( - 'if(cos(2), cos(2), 0)')); + 'if(cos(2), cos(2), 0)' + )); } public function testEvaluateFunctionParameters() { $calculator = new MathExecutor(); - $calculator->addFunction('round', function ($value, $decimals) { + $calculator->addFunction( + 'round', + function ($value, $decimals) { return round($value, $decimals); } ); @@ -314,7 +323,9 @@ class MathTest extends TestCase { $calculator = new MathExecutor(); $testString = "some, long. arg; with: different-separators!"; - $calculator->addFunction('test', function ($arg) use ($testString) { + $calculator->addFunction( + 'test', + function ($arg) use ($testString) { $this->assertEquals($testString, $arg); return 0; } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 8eb3e7a..9c6e09c 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -4,8 +4,8 @@ $vendorDir = __DIR__ . '/../../..'; if (file_exists($file = $vendorDir . '/autoload.php')) { require_once $file; -} else if (file_exists($file = './vendor/autoload.php')) { +} elseif (file_exists($file = './vendor/autoload.php')) { require_once $file; } else { throw new \RuntimeException("Not found composer autoload"); -}
\ No newline at end of file +} |