Skip to content

Commit 5aa4362

Browse files
committed
AbstractMethodUnitTest: allow for select tests to use tabs in the test case file
An individual test can set the `$tabWidth` property in the test file to overwrite the default value.
1 parent fe453f8 commit 5aa4362

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/Core/AbstractMethodUnitTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ abstract class AbstractMethodUnitTest extends TestCase
2828
*/
2929
protected static $fileExtension = 'inc';
3030

31+
/**
32+
* The tab width setting to use when tokenizing the file.
33+
*
34+
* This allows for test case files to use a different tab width than the default.
35+
*
36+
* @var integer
37+
*/
38+
protected static $tabWidth = 4;
39+
3140
/**
3241
* The \PHP_CodeSniffer\Files\File object containing the parsed contents of the test case file.
3342
*
@@ -63,7 +72,10 @@ public static function initializeFile()
6372
self::setStaticConfigProperty('configData', ['report_width' => 80]);
6473
self::setStaticConfigProperty('configDataFile', '');
6574

66-
$config = new Config();
75+
$config = new Config();
76+
// Also set a tab-width to enable testing tab-replaced vs `orig_content`.
77+
$config->tabWidth = static::$tabWidth;
78+
6779
$ruleset = new Ruleset($config);
6880

6981
// Default to a file with the same name as the test class. Extension is property based.

0 commit comments

Comments
 (0)