From 37e969e8c4ec3195cef2d97749bb66de460b433e Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 20 Feb 2024 11:07:19 +0100 Subject: [PATCH] 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. --- tests/Core/AbstractMethodUnitTest.php | 2 +- tests/Core/Tokenizer/AbstractTokenizerTestCase.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Core/AbstractMethodUnitTest.php b/tests/Core/AbstractMethodUnitTest.php index 5d625891c9..258f0b35fb 100644 --- a/tests/Core/AbstractMethodUnitTest.php +++ b/tests/Core/AbstractMethodUnitTest.php @@ -73,7 +73,7 @@ public static function initializeFile() $contents .= file_get_contents($pathToTestFile); self::$phpcsFile = new DummyFile($contents, $ruleset, $config); - self::$phpcsFile->process(); + self::$phpcsFile->parse(); }//end initializeFile() diff --git a/tests/Core/Tokenizer/AbstractTokenizerTestCase.php b/tests/Core/Tokenizer/AbstractTokenizerTestCase.php index aa2dc18d1d..c9e09c07d4 100644 --- a/tests/Core/Tokenizer/AbstractTokenizerTestCase.php +++ b/tests/Core/Tokenizer/AbstractTokenizerTestCase.php @@ -78,7 +78,7 @@ protected function initializeFile() $contents .= file_get_contents($pathToTestFile); $this->phpcsFile = new DummyFile($contents, $ruleset, $config); - $this->phpcsFile->process(); + $this->phpcsFile->parse(); } }//end initializeFile()