CloverTest.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. if (!defined('TEST_FILES_PATH')) {
  11. define(
  12. 'TEST_FILES_PATH',
  13. dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR .
  14. '_files' . DIRECTORY_SEPARATOR
  15. );
  16. }
  17. require_once TEST_FILES_PATH . '../TestCase.php';
  18. /**
  19. * Tests for the PHP_CodeCoverage_Report_Clover class.
  20. *
  21. * @since Class available since Release 1.0.0
  22. */
  23. class PHP_CodeCoverage_Report_CloverTest extends PHP_CodeCoverage_TestCase
  24. {
  25. /**
  26. * @covers PHP_CodeCoverage_Report_Clover
  27. */
  28. public function testCloverForBankAccountTest()
  29. {
  30. $clover = new PHP_CodeCoverage_Report_Clover;
  31. $this->assertStringMatchesFormatFile(
  32. TEST_FILES_PATH . 'BankAccount-clover.xml',
  33. $clover->process($this->getCoverageForBankAccount(), null, 'BankAccount')
  34. );
  35. }
  36. /**
  37. * @covers PHP_CodeCoverage_Report_Clover
  38. */
  39. public function testCloverForFileWithIgnoredLines()
  40. {
  41. $clover = new PHP_CodeCoverage_Report_Clover;
  42. $this->assertStringMatchesFormatFile(
  43. TEST_FILES_PATH . 'ignored-lines-clover.xml',
  44. $clover->process($this->getCoverageForFileWithIgnoredLines())
  45. );
  46. }
  47. /**
  48. * @covers PHP_CodeCoverage_Report_Clover
  49. */
  50. public function testCloverForClassWithAnonymousFunction()
  51. {
  52. $clover = new PHP_CodeCoverage_Report_Clover;
  53. $this->assertStringMatchesFormatFile(
  54. TEST_FILES_PATH . 'class-with-anonymous-function-clover.xml',
  55. $clover->process($this->getCoverageForClassWithAnonymousFunction())
  56. );
  57. }
  58. }