mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-03 09:50:49 +00:00
[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();
|
$addedFilesWithContent = $this->removedAndAddedFilesCollector->getAddedFilesWithContent();
|
||||||
$addedFiles = [];
|
$addedFiles = [];
|
||||||
foreach ($addedFilesWithContent as $addedFileWithContent) {
|
foreach ($addedFilesWithContent as $addedFileWithContent) {
|
||||||
$addedFiles[$addedFileWithContent->getFilePath()] = $addedFileWithContent;
|
[, $addedFilePathWithContentFilePath] = explode(
|
||||||
|
'_temp_fixture_easy_testing',
|
||||||
|
$addedFileWithContent->getFilePath()
|
||||||
|
);
|
||||||
|
$addedFiles[$addedFilePathWithContentFilePath] = $addedFileWithContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($expectedFileChanges as $path => $expectedFileChange) {
|
foreach ($expectedFileChanges as $path => $expectedFileChange) {
|
||||||
$addedFile = $addedFiles[$path] ?? null;
|
[, $relativePath] = explode('_temp_fixture_easy_testing', $path);
|
||||||
$this->assertSame($path, $addedFile ? $addedFile->getFilePath() : null);
|
$addedFile = $addedFiles[$relativePath] ?? null;
|
||||||
|
[, $addedFilePathWithContentFilePath] = $addedFile
|
||||||
|
? explode('_temp_fixture_easy_testing', $addedFile->getFilePath())
|
||||||
|
: null;
|
||||||
|
|
||||||
|
$this->assertSame($relativePath, $addedFilePathWithContentFilePath);
|
||||||
$realFileContent = $addedFile ? trim($addedFile->getFileContent()) : null;
|
$realFileContent = $addedFile ? trim($addedFile->getFileContent()) : null;
|
||||||
$this->assertSame($expectedFileChange, $realFileContent);
|
$this->assertSame($expectedFileChange, $realFileContent);
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user