UtilTest.php 804 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /*
  3. * This file is part of the PHP_CodeCoverage package.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Tests for the PHP_CodeCoverage_Util class.
  12. *
  13. * @since Class available since Release 1.0.0
  14. */
  15. class PHP_CodeCoverage_UtilTest extends PHPUnit_Framework_TestCase
  16. {
  17. /**
  18. * @covers PHP_CodeCoverage_Util::percent
  19. */
  20. public function testPercent()
  21. {
  22. $this->assertEquals(100, PHP_CodeCoverage_Util::percent(100, 0));
  23. $this->assertEquals(100, PHP_CodeCoverage_Util::percent(100, 100));
  24. $this->assertEquals(
  25. '100.00%',
  26. PHP_CodeCoverage_Util::percent(100, 100, true)
  27. );
  28. }
  29. }