* Dariusz RumiƄski * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\Tests\Fixer\PhpTag; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\Fixer\PhpTag\NoClosingTagFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\PhpTag\NoClosingTagFixer> */ final class NoClosingTagFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideWithFullOpenTagCases */ public function testWithFullOpenTag(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @dataProvider provideWithShortOpenTagCases */ public function testWithShortOpenTag(string $expected, ?string $input = null): void { if (!\ini_get('short_open_tag')) { self::markTestSkipped('The short_open_tag option is required to be enabled.'); } $this->doTest($expected, $input); } /** * @return iterable */ public static function provideWithFullOpenTagCases(): iterable { yield [ '', ]; yield [ '', ]; yield [ ' PLAIN TEXT', ]; yield [ 'PLAIN TEXT', ]; yield [ '', ]; yield [ '

', ]; yield [ '', ]; yield [ '', ]; yield [ '', ]; yield [ '', ]; yield 'Trailing linebreak, priority issue with SingleBlankLineAtEofFixer.' => [ '\n", ]; yield 'Trailing comment.' => [ '", ]; yield 'No code' => [ '', ]; yield 'No code, only comment' => [ '', ]; yield [ 'aa', ]; } /** * @return iterable */ public static function provideWithShortOpenTagCases(): iterable { yield [ '', ]; yield [ '', ]; yield [ '

', ]; yield [ '', ]; yield [ ' ', ]; yield [ '', ]; } }