TextTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /*
  3. * This file is part of the php-code-coverage 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. namespace SebastianBergmann\CodeCoverage\Report;
  11. use SebastianBergmann\CodeCoverage\TestCase;
  12. /**
  13. * @covers SebastianBergmann\CodeCoverage\Report\Text
  14. */
  15. class TextTest extends TestCase
  16. {
  17. public function testTextForBankAccountTest()
  18. {
  19. $text = new Text(50, 90, false, false);
  20. $this->assertStringMatchesFormatFile(
  21. TEST_FILES_PATH . 'BankAccount-text.txt',
  22. str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForBankAccount()))
  23. );
  24. }
  25. public function testTextForFileWithIgnoredLines()
  26. {
  27. $text = new Text(50, 90, false, false);
  28. $this->assertStringMatchesFormatFile(
  29. TEST_FILES_PATH . 'ignored-lines-text.txt',
  30. str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFileWithIgnoredLines()))
  31. );
  32. }
  33. public function testTextForClassWithAnonymousFunction()
  34. {
  35. $text = new Text(50, 90, false, false);
  36. $this->assertStringMatchesFormatFile(
  37. TEST_FILES_PATH . 'class-with-anonymous-function-text.txt',
  38. str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForClassWithAnonymousFunction()))
  39. );
  40. }
  41. }