mirror of https://github.com/rectorphp/rector.git
[Testing] Fixing MultipleFilesChangedTrait under macOs (#605)
* [Testing] Fixing mMultipleFilesChangedTrait under macOs * final touch * [ci-review] Rector Rectify * [ci-review] Rector Rectify * use relative path as key Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
bb384013c3
commit
d4d2e7a4d5
|
@ -76,12 +76,21 @@ trait MultipleFilesChangedTrait
|
|||
$addedFilesWithContent = $this->removedAndAddedFilesCollector->getAddedFilesWithContent();
|
||||
$addedFiles = [];
|
||||
foreach ($addedFilesWithContent as $addedFileWithContent) {
|
||||
$addedFiles[$addedFileWithContent->getFilePath()] = $addedFileWithContent;
|
||||
[, $addedFilePathWithContentFilePath] = explode(
|
||||
'_temp_fixture_easy_testing',
|
||||
$addedFileWithContent->getFilePath()
|
||||
);
|
||||
$addedFiles[$addedFilePathWithContentFilePath] = $addedFileWithContent;
|
||||
}
|
||||
|
||||
foreach ($expectedFileChanges as $path => $expectedFileChange) {
|
||||
$addedFile = $addedFiles[$path] ?? null;
|
||||
$this->assertSame($path, $addedFile ? $addedFile->getFilePath() : null);
|
||||
[, $relativePath] = explode('_temp_fixture_easy_testing', $path);
|
||||
$addedFile = $addedFiles[$relativePath] ?? null;
|
||||
[, $addedFilePathWithContentFilePath] = $addedFile
|
||||
? explode('_temp_fixture_easy_testing', $addedFile->getFilePath())
|
||||
: null;
|
||||
|
||||
$this->assertSame($relativePath, $addedFilePathWithContentFilePath);
|
||||
$realFileContent = $addedFile ? trim($addedFile->getFileContent()) : null;
|
||||
$this->assertSame($expectedFileChange, $realFileContent);
|
||||
if (file_exists($path)) {
|
||||
|
|
Loading…
Reference in New Issue