|
| 1 | +<?php |
| 2 | +/* |
| 3 | + * This file is part of the PHP_CodeCoverage package. |
| 4 | + * |
| 5 | + * (c) Sebastian Bergmann <[email protected]> |
| 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 | +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestCase.php'; |
| 12 | + |
| 13 | +/** |
| 14 | + * Tests for the PHP_CodeCoverage_Report_Text class. |
| 15 | + * |
| 16 | + * @since Class available since Release 3.0.2 |
| 17 | + */ |
| 18 | +class PHP_CodeCoverage_Report_TextTest extends PHP_CodeCoverage_TestCase |
| 19 | +{ |
| 20 | + /** |
| 21 | + * @covers PHP_CodeCoverage_Report_Text |
| 22 | + */ |
| 23 | + public function testTextForBankAccountTest() |
| 24 | + { |
| 25 | + $text = new PHP_CodeCoverage_Report_Text(50, 90, false, false); |
| 26 | + |
| 27 | + $this->assertStringMatchesFormatFile( |
| 28 | + TEST_FILES_PATH . 'BankAccount-text.txt', |
| 29 | + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForBankAccount())) |
| 30 | + ); |
| 31 | + } |
| 32 | + |
| 33 | + /** |
| 34 | + * @covers PHP_CodeCoverage_Report_Text |
| 35 | + */ |
| 36 | + public function testTextForFileWithIgnoredLines() |
| 37 | + { |
| 38 | + $text = new PHP_CodeCoverage_Report_Text(50, 90, false, false); |
| 39 | + |
| 40 | + $this->assertStringMatchesFormatFile( |
| 41 | + TEST_FILES_PATH . 'ignored-lines-text.txt', |
| 42 | + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFileWithIgnoredLines())) |
| 43 | + ); |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * @covers PHP_CodeCoverage_Report_Text |
| 48 | + */ |
| 49 | + public function testTextForClassWithAnonymousFunction() |
| 50 | + { |
| 51 | + $text = new PHP_CodeCoverage_Report_Text(50, 90, false, false); |
| 52 | + |
| 53 | + $this->assertStringMatchesFormatFile( |
| 54 | + TEST_FILES_PATH . 'class-with-anonymous-function-text.txt', |
| 55 | + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForClassWithAnonymousFunction())) |
| 56 | + ); |
| 57 | + } |
| 58 | +} |
0 commit comments