Closed flap152 closed 1 year ago
Because it seems environment related, I'm thinking it might be related to core.autocrlf=true
in git config
, at least for the failing tests part.
Let's see if I can test this theory.
So are you saying this changed fixed the problem:
- $file = File::fromString($contents);
+ $file = File::fromString($contents, true);
Yes it did. In the meantime, I managed to confirm that if the fixtures use LF instead of CRLF, the test passes without or with our the modification. The task also works in my application if migrations use LF instead of CRLFs. I played around with git configs (autocrlf, text, eol...) until I got LFs or CRLFs and that is the difference. Manually toggling line-endings alos fixes/breaks the task. (PHPStorm user - not a git expert)
I think the proper solution would be to update File
to only split on newlines by default. I'll look in the morning.
This should be resolved in 0.2.9. Let me know it not.
It worked. Thanks.
Issue:
I get errors using shift-cli with the DownMigration task. It removed the wrong lines and left the code in error. It chopped of the end of a comment block, part of the up method and left the down method intact) Investigating, I thought I had some control over the problem (the more comment lines I had, the more it removed, but still in the wrong place) Now to isolate the problem, I tried to run it on a small project, but thought it would be better to confirm the intended behaviour, so I cloned the package and ran the tests. I got errors related to path separator and line endings CR/LF. The line separator "bug" seemed to be in the tests themselves. But I was not sure about the CR / CRLF problem. Are shift-cli tests only expected to run on CI so not Windows?
So I found the parsing of the migration wrongly "created new lines" for EACH CR and LF, then removed the wrong lines because the indexing is wrong. This change fixed the original problem:
Command:
on shift-cli clone:
on my project:
Output: