DivisionTest.php 817 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Math\Test\Unit;
  7. class DivisionTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @dataProvider getExactDivisionDataProvider
  11. */
  12. public function testGetExactDivision($dividend, $divisor, $expected)
  13. {
  14. $mathDivision = new \Magento\Framework\Math\Division();
  15. $remainder = $mathDivision->getExactDivision($dividend, $divisor);
  16. $this->assertEquals($expected, $remainder);
  17. }
  18. /**
  19. * @return array
  20. */
  21. public function getExactDivisionDataProvider()
  22. {
  23. return [
  24. [17, 3 , 2],
  25. [7.7, 2 , 1.7],
  26. [17.8, 3.2 , 1.8],
  27. [11.7, 1.7 , 1.5],
  28. [8, 2, 0]
  29. ];
  30. }
  31. }