* * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace Symfony\CS\Tests\Fixer\Contrib; use Symfony\CS\Tests\Fixer\AbstractFixerTestBase; /** * @author Dariusz RumiƄski */ class PhpUnitStrictFixerTest extends AbstractFixerTestBase { /** * @dataProvider provideTestFixCases */ public function testFix($expected, $input = null) { $this->makeTest($expected, $input); } public function provideTestFixCases() { $fixerReflection = new \ReflectionClass($this->getFixer()); $propertyReflection = $fixerReflection->getProperty('configuration'); $propertyReflection->setAccessible(true); $methodsMap = $propertyReflection->getValue($this->getFixer()); $cases = array( array('foo();'), ); foreach ($methodsMap as $methodBefore => $methodAfter) { $cases[] = array("$methodBefore(1, 1);"); $cases[] = array("$methodAfter(1, 1);"); $cases[] = array( "$methodAfter(1, 2);", "$methodBefore(1, 2);", ); $cases[] = array( "$methodAfter(1, 2); \$this->$methodAfter(1, 2);", "$methodBefore(1, 2); \$this->$methodBefore(1, 2);", ); $cases[] = array( "$methodAfter(1, 2, 'descr');", "$methodBefore(1, 2, 'descr');", ); $cases[] = array( "/*aaa*/$methodAfter \t /**bbb*/ ( /*ccc*/1 , 2);", "/*aaa*/$methodBefore \t /**bbb*/ ( /*ccc*/1 , 2);", ); $cases[] = array( "$methodAfter(\$expectedTokens->count() + 10, \$tokens->count() ? 10 : 20 , 'Test');", "$methodBefore(\$expectedTokens->count() + 10, \$tokens->count() ? 10 : 20 , 'Test');", ); } return $cases; } }