From c6d11cdbd6ee41a8b4e072a8fa76864174164358 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 23 Apr 2023 22:19:58 +0700 Subject: [PATCH] [Testing] Reduce IO on AbstractRectorTestCase::doTestFile() (#3670) * [Testing] Reduce IO on AbstractRectorTestCase::doTestFile() * direct call --- packages/Testing/Fixture/FixtureSplitter.php | 9 ++++++++- packages/Testing/PHPUnit/AbstractRectorTestCase.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/Testing/Fixture/FixtureSplitter.php b/packages/Testing/Fixture/FixtureSplitter.php index 77990978768..38a1320ff1d 100644 --- a/packages/Testing/Fixture/FixtureSplitter.php +++ b/packages/Testing/Fixture/FixtureSplitter.php @@ -5,7 +5,6 @@ use Nette\Utils\FileSystem; use Nette\Utils\Strings; -use Webmozart\Assert\Assert; /** * @api @@ -33,4 +32,12 @@ public static function split(string $filePath): array return Strings::split($fixtureFileContents, self::SPLIT_LINE_REGEX); } + + /** + * @return array + */ + public static function splitFixtureFileContents(string $fixtureFileContents): array + { + return Strings::split($fixtureFileContents, self::SPLIT_LINE_REGEX); + } } diff --git a/packages/Testing/PHPUnit/AbstractRectorTestCase.php b/packages/Testing/PHPUnit/AbstractRectorTestCase.php index e67a41ba6fc..be6f93eaa0b 100644 --- a/packages/Testing/PHPUnit/AbstractRectorTestCase.php +++ b/packages/Testing/PHPUnit/AbstractRectorTestCase.php @@ -107,7 +107,7 @@ protected function doTestFile(string $fixtureFilePath): void if (FixtureSplitter::containsSplit($fixtureFileContents)) { // changed content - [$inputFileContents, $expectedFileContents] = FixtureSplitter::split($fixtureFilePath); + [$inputFileContents, $expectedFileContents] = FixtureSplitter::splitFixtureFileContents($fixtureFileContents); } else { // no change $inputFileContents = $fixtureFileContents;