zendframework / zend-servicemanager

ServiceManager component from Zend Framework
BSD 3-Clause "New" or "Revised" License
188 stars 89 forks source link

FIX: Make tests platform agnostic #244

Closed fhein closed 6 years ago

fhein commented 6 years ago

Standardizes asserts comparing (file based) strings to "\n" line delimiter. Without this patch the test suite reports nine failures on Windows.

Currently I have to phpcbf in order to make the tests pass. Problem with that is, that after the phpcbf run git sees almost all files changed.

fhein commented 6 years ago

Ok, there is git config setting called autocrlf. This seems to be set true by default on Win installations. Turn that off and make sure your editors use "\n" instead of "\r\n", then all works without this patch.

Nevertheless I propose to apply this patch. If a user opened a generated file with an arbitrary editor, which silently converts line delimiters to native, corrected the generated file manually to find if the test would pass with that corrections, he would get disappointed.

Ocramius commented 6 years ago

Files are supposed to maintain their \n line endings, and that is also what you will get from distribution composer packages, so I don't think the patch should be applied. \r\n or \n\r should never ever be generated. If any code generator does that, we need to instead adapt generator to produce \n

On 31 Jan 2018 01:07, "Frank Hein" notifications@github.com wrote:

Ok, there is git config setting called autocrlf. This seems to be set true by default on Win installations. Turn that off and make sure your editors use "\n" instead of "\r\n", then all works without this patch.

Nevertheless I propose to apply this patch. If a user opened a generated file with an arbitrary editor, which silently converts line delimiters to native, corrected the generated file manually to find if the test would pass with that corrections, he would get disappointed.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zendframework/zend-servicemanager/pull/244#issuecomment-361778087, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakGrt4E5U51IVv4IatBWwafTshQdhks5tP67GgaJpZM4RyhQv .