* 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\FunctionNotation; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\AbstractFopenFlagFixer * @covers \PhpCsFixer\Fixer\FunctionNotation\FopenFlagsFixer */ final class FopenFlagsFixerTest extends AbstractFixerTestCase { /** * @param array $config * * @dataProvider provideFixCases */ public function testFix(string $expected, string $input, array $config = []): void { $this->fixer->configure($config); $this->doTest($expected, $input); } public static function provideFixCases(): iterable { yield 'missing "b"' => [ ' [ ' [ ' [ ' false], ]; yield '"t" and superfluous "b"' => [ ' false], ]; yield 'superfluous "b"' => [ ' false], ]; } /** * @dataProvider provideDoNotFixCases */ public function testDoNotFix(string $expected): void { $this->doTest($expected); $this->fixer->configure(['b_mode' => false]); $this->doTest($expected); } public static function provideDoNotFixCases(): iterable { yield 'not simple flags' => [ ' [ ' [ ' [ ' [ ' [ 'fopen($foo, "r+");', ]; yield 'comments, PHPDoc and literal' => [ ' [ '