* 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\ControlStructure; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Саша Стаменковић * * @internal * * @covers \PhpCsFixer\Fixer\ControlStructure\IncludeFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\ControlStructure\IncludeFixer> */ final class IncludeFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixCases(): iterable { yield [ '', $statement), \sprintf($template.' ("foo.php") ?>', $statement), ]; yield [ \sprintf($template.' /**/"foo.php"// test ?>', $statement), \sprintf($template.'/**/ ("foo.php") // test ?>', $statement), ]; yield [ \sprintf($template.' $a;', $statement), \sprintf($template.'$a;', $statement), ]; yield [ \sprintf($template.' $a;', $statement), \sprintf($template.' $a;', $statement), ]; yield [ \sprintf($template.' $a; ', $statement), \sprintf($template.' $a ; ', $statement), ]; yield [ \sprintf($template." /**/'foo.php';", $statement), \sprintf($template."/**/'foo.php';", $statement), ]; yield [ \sprintf($template." 'foo.php';", $statement), \sprintf($template."'foo.php';", $statement), ]; yield [ \sprintf($template." 'foo.php';", $statement), \sprintf($template." 'foo.php';", $statement), ]; yield [ \sprintf($template." 'foo.php';", $statement), \sprintf($template."('foo.php');", $statement), ]; yield [ \sprintf($template." 'foo.php';", $statement), \sprintf($template."( 'foo.php');", $statement), ]; yield [ \sprintf($template." 'foo.php';", $statement), \sprintf($template." ( 'foo.php' );", $statement), ]; yield [ \sprintf($template." '\".__DIR__.\"/../bootstrap.php';", $statement), ]; yield [ \sprintf('getCacheDir().\'classes.map\'), $this->getCacheDir(), $name, $this->debug, false, $extension);', $statement), ]; yield [ \sprintf(' [ \sprintf($template." b'foo.php';", $statement), \sprintf($template."(b'foo.php');", $statement), ]; yield $statement.': binary string upper case' => [ \sprintf($template." B'foo.php';", $statement), \sprintf($template."(B'foo.php');", $statement), ]; } } }