Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Fix line-ending mismatch on Windows test #54236

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

AhmedAlaa4611
Copy link
Contributor

Problem
The test failed when running on systems with different line-ending.

Solution
Normalize line endings for both expected and actual output.

continuation of #54233

@taylorotwell
Copy link
Member

Sorry, are the tests actually failing without this?

@AhmedAlaa4611
Copy link
Contributor Author

@taylorotwell Yes on windows

@taylorotwell
Copy link
Member

I don't see that happening in our build suite?

@taylorotwell taylorotwell reopened this Jan 17, 2025
@taylorotwell taylorotwell merged commit ad20dd5 into laravel:11.x Jan 17, 2025
43 of 44 checks passed
@AhmedAlaa4611
Copy link
Contributor Author

@taylorotwell using dd() to dump the two strings on console

<?php if (isset($component)) { $__componentOriginal2dda3d2f2f9b76bd400bf03f0b84e87f = $component; } ?>\r\n
<?php if (isset($attributes)) { $__attributesOriginal2dda3d2f2f9b76bd400bf03f0b84e87f = $attributes; } ?>\r\n
<?php $component = Illuminate\Tests\View\Blade\ComponentStub::class::resolve(["foo" => "bar"] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>\r\n
<?php $component->withName('test'); ?>\r\n
<?php if ($component->shouldRender()): ?>\r\n
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($component)) { $__componentOriginal2dda3d2f2f9b76bd400bf03f0b84e87f = $component; } ?>\n
<?php if (isset($attributes)) { $__attributesOriginal2dda3d2f2f9b76bd400bf03f0b84e87f = $attributes; } ?>\n
<?php $component = Illuminate\Tests\View\Blade\ComponentStub::class::resolve(["foo" => "bar"] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>\n
<?php $component->withName('test'); ?>\n
<?php if ($component->shouldRender()): ?>\n
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>

we can notice the difference between them is \r\n and \n, I changed the file from CRLF to LF and run the test without using str_replace and it passes, so the solution for these tests to pass on any os is to normalize files to LF ro replace \r\n with \n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants