Skip to content

Commit

Permalink
[Testing] Reduce IO on AbstractRectorTestCase::doTestFile() (#3670)
Browse files Browse the repository at this point in the history
* [Testing] Reduce IO on AbstractRectorTestCase::doTestFile()

* direct call
  • Loading branch information
samsonasik committed Apr 23, 2023
1 parent bfd083e commit c6d11cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/Testing/Fixture/FixtureSplitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use Nette\Utils\FileSystem;
use Nette\Utils\Strings;
use Webmozart\Assert\Assert;

/**
* @api
Expand Down Expand Up @@ -33,4 +32,12 @@ public static function split(string $filePath): array

return Strings::split($fixtureFileContents, self::SPLIT_LINE_REGEX);
}

/**
* @return array<string, string>
*/
public static function splitFixtureFileContents(string $fixtureFileContents): array
{
return Strings::split($fixtureFileContents, self::SPLIT_LINE_REGEX);
}
}
2 changes: 1 addition & 1 deletion packages/Testing/PHPUnit/AbstractRectorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c6d11cd

Please sign in to comment.