public function CalculatorTest::testArithmetic in Commerce Core 8.2
@covers ::add @covers ::subtract @covers ::multiply @covers ::divide @covers ::compare @covers ::trim
File
- modules/
price/ tests/ src/ Unit/ CalculatorTest.php, line 24
Class
- CalculatorTest
- Tests the Calculator class.
Namespace
Drupal\Tests\commerce_price\UnitCode
public function testArithmetic() {
$this
->assertEquals('11', Calculator::add('5', '6'));
$this
->assertEquals('-9', Calculator::subtract('11', '20'));
$this
->assertEquals('132', Calculator::multiply('11', '12'));
$this
->assertEquals('12.012', Calculator::divide('132.132', '11'));
$this
->assertEquals('3', Calculator::trim('3.00'));
$this
->assertEquals('3.03', Calculator::trim('3.030'));
}