This package is abandoned and no longer maintained. The author suggests using the symplify/easy-coding-standard package instead.

The Best Way to Test Sniffs and Fixers

v9.3.20 2021-06-05 15:50 UTC

This package is auto-updated.

Last update: 2021-06-06 16:09:35 UTC


Downloads total

Do you write your own fixer and sniffs? Would you like to test them without having to learn a lot about their internals?

This package make fixer and sniff testing with 1 single approach super easy.


composer require symplify/easy-coding-standard-tester --dev


  1. Extend Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase class

  2. Provide files to doTestFiles() method

namespace Your\CodingStandard\Tests\Fixer\YourFixer;

use Iterator;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\SmartFileSystem\SmartFileInfo;
use Your\CondingStandard\Fixer\YourFixer;

final class YourFixerTest extends AbstractCheckerTestCase
     * @dataProvider provideData()
    public function test(SmartFileInfo $fileInfo): void

    public function provideData(): Iterator
        return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');

     * @dataProvider provideDataWithFileErrors()
    public function testFileErrors(SmartFileInfo $fileInfo, int $expectedErrorCount): void
        $this->doTestFileInfoWithErrorCountOf($fileInfo, $expectedErrorCount);

    public function provideDataWithFileErrors(): Iterator
        yield [new SmartFileInfo(__DIR__ . '/Fixture/'), 1];
        yield [new SmartFileInfo(__DIR__ . '/Fixture/'), 0];

    protected function getCheckerClass(): string
        return YourFixer::class;

Instead of [__DIR__ . '/wrong/', __DIR__ . '/fixed/'] you can use single file: __DIR__ . '/fixture/' in this format:


$array = array();


$array = [];


In pseudo-code:


Report Issues

In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker


The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.