Skip to content

Commit

Permalink
Updated Rector to commit b107a16f98aecf2a5ff969e30ff48595daadc06d
Browse files Browse the repository at this point in the history
rectorphp/rector-src@b107a16 [Performance] Reduce repetitive FileSystem::read() on AbstractRectorTestCase (#5511)
  • Loading branch information
TomasVotruba committed Jan 28, 2024
1 parent 6752d80 commit e47a59a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '63fbf41cc9a6cc66c720926beec4603892eb21d0';
public const PACKAGE_VERSION = 'b107a16f98aecf2a5ff969e30ff48595daadc06d';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-01-28 00:52:19';
public const RELEASE_DATE = '2024-01-28 10:48:07';
/**
* @var int
*/
Expand Down
8 changes: 3 additions & 5 deletions src/Testing/PHPUnit/AbstractRectorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected function doTestFile(string $fixtureFilePath) : void
}
// write temp file
FileSystem::write($inputFilePath, $inputFileContents);
$this->doTestFileMatchesExpectedContent($inputFilePath, $expectedFileContents, $fixtureFilePath);
$this->doTestFileMatchesExpectedContent($inputFilePath, $inputFileContents, $expectedFileContents, $fixtureFilePath);
}
protected function forgetRectorsRulesAndCollectors() : void
{
Expand Down Expand Up @@ -169,11 +169,9 @@ private function includePreloadFilesAndScoperAutoload() : void
require_once __DIR__ . '/../../../vendor/scoper-autoload.php';
}
}
private function doTestFileMatchesExpectedContent(string $originalFilePath, string $expectedFileContents, string $fixtureFilePath) : void
private function doTestFileMatchesExpectedContent(string $originalFilePath, string $inputFileContents, string $expectedFileContents, string $fixtureFilePath) : void
{
SimpleParameterProvider::setParameter(Option::SOURCE, [$originalFilePath]);
// the original file content must be loaded first
$originalFileContent = FileSystem::read($originalFilePath);
// the file is now changed (if any rule matches)
$rectorTestResult = $this->processFilePath($originalFilePath);
$changedContents = $rectorTestResult->getChangedContents();
Expand All @@ -190,7 +188,7 @@ private function doTestFileMatchesExpectedContent(string $originalFilePath, stri
try {
$this->assertSame($expectedFileContents, $changedContents, $failureMessage);
} catch (ExpectationFailedException $exception) {
FixtureFileUpdater::updateFixtureContent($originalFileContent, $changedContents, $fixtureFilePath);
FixtureFileUpdater::updateFixtureContent($inputFileContents, $changedContents, $fixtureFilePath);
// if not exact match, check the regex version (useful for generated hashes/uuids in the code)
$this->assertStringMatchesFormat($expectedFileContents, $changedContents, $failureMessage);
}
Expand Down

0 comments on commit e47a59a

Please sign in to comment.