12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025 |
- <?php
- /*
- * This file is part of PHP CS Fixer.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- * Dariusz Rumiński <dariusz.ruminski@gmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
- namespace PhpCsFixer\Tests\Fixer\PhpUnit;
- use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
- use PhpCsFixer\WhitespacesFixerConfig;
- /**
- * @author Gert de Pagter
- *
- * @internal
- *
- * @covers \PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer
- */
- final class PhpUnitTestAnnotationFixerTest extends AbstractFixerTestCase
- {
- /**
- * @dataProvider provideFixCases
- *
- * @param string $expected
- * @param null|string $input
- */
- public function testFix($expected, $input = null, array $config = [])
- {
- $this->fixer->configure($config);
- $this->doTest($expected, $input);
- }
- /**
- * @return array
- */
- public function provideFixCases()
- {
- return [
- 'Annotation is used, and it should not be' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- *
- */
- public function testItDoesSomething() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function itDoesSomething() {}
- }',
- ['style' => 'prefix'],
- ],
- 'Annotation is not used, but should be' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function itDoesSomething() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function testItDoesSomething() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation is not used, but should be, class is extra indented' => [
- '<?php
- if (1) {
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function itDoesSomething() {}
- }
- }',
- '<?php
- if (1) {
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function testItDoesSomething() {}
- }
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation is not used, but should be, and there is already a docBlock' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @dataProvider blabla
- *
- * @test
- */
- public function itDoesSomething() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @dataProvider blabla
- */
- public function testItDoesSomething() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation is used, but should not be, and it depends on other tests' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- *
- */
- public function testAaa () {}
- public function helperFunction() {}
- /**
- * @depends testAaa
- *
- *
- */
- public function testBbb () {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function aaa () {}
- public function helperFunction() {}
- /**
- * @depends aaa
- *
- * @test
- */
- public function bbb () {}
- }',
- ['style' => 'prefix'],
- ],
- 'Annotation is not used, but should be, and it depends on other tests' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function aaa () {}
- /**
- * @depends aaa
- *
- * @test
- */
- public function bbb () {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function testAaa () {}
- /**
- * @depends testAaa
- */
- public function testBbb () {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation is removed, the function is one word and we want it to use camel case' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- *
- */
- public function testWorks() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function works() {}
- }',
- ],
- 'Annotation is added, and it is snake case' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function it_has_snake_case() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function test_it_has_snake_case() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation gets added, it has an @depends, and we use snake case' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function works_fine () {}
- /**
- * @depends works_fine
- *
- * @test
- */
- public function works_fine_too() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function test_works_fine () {}
- /**
- * @depends test_works_fine
- */
- public function test_works_fine_too() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Class has both camel and snake case, annotated functions and not, and wants to add annotations' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function snake_cased () {}
- /**
- * @test
- */
- public function camelCased () {}
- /**
- * Description.
- *
- * @depends camelCased
- *
- * @test
- */
- public function depends_on_someone () {}
- //It even has a comment
- public function a_helper_function () {}
- /**
- * @depends depends_on_someone
- *
- * @test
- */
- public function moreDepends() {}
- /**
- * @depends depends_on_someone
- *
- * @test
- */
- public function alreadyAnnotated() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function test_snake_cased () {}
- public function testCamelCased () {}
- /**
- * Description.
- *
- * @depends testCamelCased
- */
- public function test_depends_on_someone () {}
- //It even has a comment
- public function a_helper_function () {}
- /**
- * @depends test_depends_on_someone
- */
- public function testMoreDepends() {}
- /**
- * @depends test_depends_on_someone
- *
- * @test
- */
- public function alreadyAnnotated() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation has to be added to multiple functions' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function itWorks() {}
- /**
- * @test
- */
- public function itDoesSomething() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function testItWorks() {}
- public function testItDoesSomething() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Class with big doc blocks and multiple functions has to remove annotations' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * This test is part of the database group and has a provider.
- *
- * @param int $paramOne
- * @param bool $paramTwo
- *
- *
- * @dataProvider provides
- * @group Database
- */
- public function testDatabase ($paramOne, $paramTwo) {}
- /**
- * Provider for the database test function
- *
- * @return array
- */
- public function provides() {}
- /**
- * Im just a helper function but i have test in my name.
- * I also have a doc Block
- *
- * @return Foo\Bar
- */
- public function help_test() {}
- protected function setUp() {}
- /**
- * I depend on the database function, but i already
- * had test in my name and a docblock
- *
- * @depends testDatabase
- */
- public function testDepends () {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * This test is part of the database group and has a provider.
- *
- * @param int $paramOne
- * @param bool $paramTwo
- *
- * @test
- * @dataProvider provides
- * @group Database
- */
- public function database ($paramOne, $paramTwo) {}
- /**
- * Provider for the database test function
- *
- * @return array
- */
- public function provides() {}
- /**
- * Im just a helper function but i have test in my name.
- * I also have a doc Block
- *
- * @return Foo\Bar
- */
- public function help_test() {}
- protected function setUp() {}
- /**
- * I depend on the database function, but i already
- * had test in my name and a docblock
- *
- * @depends database
- */
- public function testDepends () {}
- }',
- ],
- 'Test Annotation has to be removed, but its just one line' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /** */
- public function testItWorks() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /** @test */
- public function itWorks() {}
- }',
- ],
- 'Test annotation has to be added, but there is already a one line doc block' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @group Database
- *
- * @test
- */
- public function itTestsDatabase() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /** @group Database */
- public function testItTestsDatabase() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Test annotation has to be added, but there is already a one line doc block which is a sentence' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * I really like this test, it helps a lot
- *
- * @test
- */
- public function itTestsDatabase() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /** I really like this test, it helps a lot */
- public function testItTestsDatabase() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Test annotation has to be added, but there is already a one line comment present' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- //I really like this test, it helps a lot
- /**
- * @test
- */
- public function itTestsDatabase() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- //I really like this test, it helps a lot
- public function testItTestsDatabase() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Test annotation has to be added, there is a one line doc block which is an @depends tag' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function itTestsDatabase() {}
- /**
- * @depends itTestsDatabase
- *
- * @test
- */
- public function itDepends() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function testItTestsDatabase() {}
- /** @depends testItTestsDatabase */
- public function testItDepends() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation gets removed, but the function has a @testWith' => [
- '<?php
- final class ProcessLinterProcessBuilderTest extends TestCase
- {
- /**
- *
- * @param string $executable
- * @param string $file
- * @param string $expected
- *
- * @testWith ["php", "foo.php", "\"php\" -l \"foo.php\""]
- * ["C:\\Program Files\\php\\php.exe", "foo bar\\baz.php", "\"C:\\Program Files\\php\\php.exe\" -l \"foo bar\\baz.php\""]
- * @requires OS Linux|Darwin
- */
- public function testPrepareCommandOnPhpOnLinuxOrMac($executable, $file, $expected)
- {
- $builder = new ProcessLinterProcessBuilder($executable);
- $this->assertSame(
- $expected,
- $builder->build($file)->getCommandLine()
- );
- }
- }',
- '<?php
- final class ProcessLinterProcessBuilderTest extends TestCase
- {
- /**
- * @test
- * @param string $executable
- * @param string $file
- * @param string $expected
- *
- * @testWith ["php", "foo.php", "\"php\" -l \"foo.php\""]
- * ["C:\\Program Files\\php\\php.exe", "foo bar\\baz.php", "\"C:\\Program Files\\php\\php.exe\" -l \"foo bar\\baz.php\""]
- * @requires OS Linux|Darwin
- */
- public function prepareCommandOnPhpOnLinuxOrMac($executable, $file, $expected)
- {
- $builder = new ProcessLinterProcessBuilder($executable);
- $this->assertSame(
- $expected,
- $builder->build($file)->getCommandLine()
- );
- }
- }',
- ],
- 'Annotation gets added, but there is already an @testWith in the doc block' => [
- '<?php
- final class ProcessLinterProcessBuilderTest extends TestCase
- {
- /**
- * @param string $executable
- * @param string $file
- * @param string $expected
- *
- * @testWith ["php", "foo.php", "\"php\" -l \"foo.php\""]
- * ["C:\\Program Files\\php\\php.exe", "foo bar\\baz.php", "\"C:\\Program Files\\php\\php.exe\" -l \"foo bar\\baz.php\""]
- * @requires OS Linux|Darwin
- *
- * @test
- */
- public function prepareCommandOnPhpOnLinuxOrMac($executable, $file, $expected)
- {
- $builder = new ProcessLinterProcessBuilder($executable);
- $this->assertSame(
- $expected,
- $builder->build($file)->getCommandLine()
- );
- }
- }',
- '<?php
- final class ProcessLinterProcessBuilderTest extends TestCase
- {
- /**
- * @param string $executable
- * @param string $file
- * @param string $expected
- *
- * @testWith ["php", "foo.php", "\"php\" -l \"foo.php\""]
- * ["C:\\Program Files\\php\\php.exe", "foo bar\\baz.php", "\"C:\\Program Files\\php\\php.exe\" -l \"foo bar\\baz.php\""]
- * @requires OS Linux|Darwin
- */
- public function testPrepareCommandOnPhpOnLinuxOrMac($executable, $file, $expected)
- {
- $builder = new ProcessLinterProcessBuilder($executable);
- $this->assertSame(
- $expected,
- $builder->build($file)->getCommandLine()
- );
- }
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation gets properly removed, even when it is in a weird place' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * Im a comment about the function
- */
- public function testIHateMyTestSuite() {}
- /**
- * Im another comment about a function
- */
- public function testThisMakesNoSense() {}
- /**
- * This comment has more issues
- */
- public function testItUsesTabs() {}
- /**
- * @depends testItUsesTabs
- */
- public function testItDependsReally() {}
- /**
- * @depends testItUsesTabs
- */
- public function testItDependsSomeMore() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * Im a comment @test about the function
- */
- public function iHateMyTestSuite() {}
- /**
- * Im another comment about a function @test
- */
- public function thisMakesNoSense() {}
- /**
- * This comment has @test more issues
- */
- public function itUsesTabs() {}
- /**
- * @depends itUsesTabs @test
- */
- public function itDependsReally() {}
- /**
- * @test @depends itUsesTabs
- */
- public function itDependsSomeMore() {}
- }',
- ],
- 'Annotation gets added when a single line has doc block has multiple tags already' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * There is some text here @group Database @group Integration
- *
- * @test
- */
- public function whyDoThis() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /** There is some text here @group Database @group Integration */
- public function testWhyDoThis() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation gets removed when a single line doc block has the tag, but there are other things as well' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /** There is some text here @group Database @group Integration */
- public function testWhyDoThis() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /** There is some @test text here @group Database @group Integration */
- public function testWhyDoThis() {}
- }',
- ],
- 'Annotation is used, and should be' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function itDoesSomething() {}
- }',
- null,
- ['style' => 'annotation'],
- ],
- 'Annotation is not used, and should not be' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function testItDoesSomethingWithoutPhpDoc() {}
- /**
- * No annotation, just text
- */
- public function testItDoesSomethingWithPhpDoc() {}
- public function testingItDoesSomethingWithoutPhpDoc() {}
- /**
- * No annotation, just text
- */
- public function testingItDoesSomethingWithPhpDoc() {}
- }',
- ],
- 'Annotation is added when it is already present in a weird place' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * Im a comment @test about the function
- *
- * @test
- */
- public function iHateMyTestSuite() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * Im a comment @test about the function
- */
- public function iHateMyTestSuite() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Docblock does not get converted to a multi line doc block if it already has @test annotation' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /** @test */
- public function doesSomeThings() {}
- }',
- null,
- ['style' => 'annotation'],
- ],
- 'Annotation does not get added if class is not a test' => [
- '<?php
- class Waterloo
- {
- public function testDoesSomeThings() {}
- }',
- null,
- ['style' => 'annotation'],
- ],
- 'Annotation does not get removed if class is not a test' => [
- '<?php
- class Waterloo
- {
- /**
- * @test
- */
- public function doesSomeThings() {}
- }',
- ],
- 'Annotation does not get added if there are no tests in the test class' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function setUp() {}
- public function itHelpsSomeTests() {}
- public function someMoreChanges() {}
- }',
- null,
- ['style' => 'annotation'],
- ],
- 'Abstract test gets annotation removed' => [
- '<?php
- abstract class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- *
- */
- abstract function testFooBar();
- }',
- '<?php
- abstract class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- abstract function fooBar();
- }',
- ['style' => 'prefix'],
- ],
- 'Annotation present, but method already have test prefix' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- *
- */
- public function testarossaIsFromItaly() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function testarossaIsFromItaly() {}
- }',
- ['style' => 'prefix'],
- ],
- 'Annotation present, but method is test prefix' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- *
- */
- public function test() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function test() {}
- }',
- ['style' => 'prefix'],
- ],
- 'Abstract test gets annotation added' => [
- '<?php
- abstract class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- abstract function fooBar();
- }',
- '<?php
- abstract class Test extends \PhpUnit\FrameWork\TestCase
- {
- abstract function testFooBar();
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation gets added, but there is a number after the testprefix so it keeps the prefix' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function test123fooBar() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function test123fooBar() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation missing, but there is a lowercase character after the test prefix so it keeps the prefix' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function testarossaIsFromItaly() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function testarossaIsFromItaly() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation present, but there is a lowercase character after the test prefix so it keeps the prefix' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function testarossaIsFromItaly() {}
- }',
- null,
- ['style' => 'annotation'],
- ],
- 'Annotation missing, method qualifies as test, but test prefix cannot be removed' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function test() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function test() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation missing, method qualifies as test, but test_ prefix cannot be removed' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function test_() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function test_() {}
- }',
- ['style' => 'annotation'],
- ],
- 'Annotation present, method qualifies as test, but test_ prefix cannot be removed' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function test_() {}
- }',
- null,
- ['style' => 'annotation'],
- ],
- 'Annotation missing, method after fix still has "test" prefix' => [
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- /**
- * @test
- */
- public function test_foo() {}
- }',
- '<?php
- class Test extends \PhpUnit\FrameWork\TestCase
- {
- public function test_test_foo() {}
- }',
- ['style' => 'annotation'],
- ],
- ];
- }
- /**
- * @param string $expected
- * @param null|string $input
- *
- * @dataProvider provideMessyWhitespacesCases
- */
- public function testMessyWhitespaces($expected, $input = null, array $config = [])
- {
- $this->fixer->setWhitespacesConfig(new WhitespacesFixerConfig("\t", "\r\n"));
- $this->fixer->configure($config);
- $this->doTest($expected, $input);
- }
- public function provideMessyWhitespacesCases()
- {
- return [
- [
- '<?php
- class FooTest extends \PHPUnit_Framework_TestCase {
- /**
- *
- */
- public function testFooTest() {}
- }
- ',
- '<?php
- class FooTest extends \PHPUnit_Framework_TestCase {
- /**
- * @test
- */
- public function fooTest() {}
- }
- ',
- ],
- ];
- }
- }
|