Skip to content

Commit 84a3888

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 6bdf7b5 commit 84a3888

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
@@ -75,7 +75,7 @@ public static function setUpBeforeClass(): void
7575
$contents .= file_get_contents($pathToTestFile);
7676

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

8080
}//end setUpBeforeClass()
8181

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)