Skip to content

Commit 37e969e

Browse files
committed
Tests/Core: performance improvement
For tests using the `AbstractMethodUnitTest` or `AbstractTokenizerTestCase` base classes the test case files only need to be parsed (tokenized), not processed (tokenized + sniffs being called). While not a huge difference, changing the function call from `File::process()` to `File::parse()`, still shaves about 1/7 of the run time off the Core tests without this change having a detrimental effect on any of the tests.
1 parent 795136c commit 37e969e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tests/Core/AbstractMethodUnitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static function initializeFile()
7373
$contents .= file_get_contents($pathToTestFile);
7474

7575
self::$phpcsFile = new DummyFile($contents, $ruleset, $config);
76-
self::$phpcsFile->process();
76+
self::$phpcsFile->parse();
7777

7878
}//end initializeFile()
7979

tests/Core/Tokenizer/AbstractTokenizerTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected function initializeFile()
7878
$contents .= file_get_contents($pathToTestFile);
7979

8080
$this->phpcsFile = new DummyFile($contents, $ruleset, $config);
81-
$this->phpcsFile->process();
81+
$this->phpcsFile->parse();
8282
}
8383

8484
}//end initializeFile()

0 commit comments

Comments
 (0)