Use platform specific EOL constant for log tests - #25
Closed
HLeithner wants to merge 1 commit into
Closed
Conversation
clue
reviewed
Jul 2, 2021
clue
left a comment
Owner
There was a problem hiding this comment.
@HLeithner Thanks for looking into this, changes LGTM!
Unfortunately this isn't currently covered by our test setup, because it currently only executes on Ubuntu. I've briefly discussed this with @SimonFrings off-channel, is this something you can look into? 👍
Contributor
Author
|
On of my development machines is windows, that's the reason I found this. Sadly (not really) I don't have any windows server or test other code on windows server so I don't have any experience run automated tests on windows. I can only run them when I do it manually... |
Contributor
|
I'll look into this one, thanks for the work so far 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The following tests are failing if you run phpunit on windows
FrameworkX\Tests\AppTest::testLogRequestResponsePrintsRequestLogWithCurrentDateAndTime
Failed asserting that '2021-07-02 11:29:09.446 127.0.0.1 "GET /users HTTP/1.1" 200 6\r\n
' matches PCRE pattern "/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3} 127.0.0.1 "GET /users HTTP/1.1" 200 6
$/".
FrameworkX\Tests\AppTest::testLogRequestResponseWithoutRemoteAddressPrintsRequestLogWithDashAsPlaceholder
Failed asserting that '2021-07-02 11:29:09.447 - "GET /users HTTP/1.1" 200 6\r\n
' matches PCRE pattern "/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3} - "GET /users HTTP/1.1" 200 6
$/".
FrameworkX\Tests\AppTest::testLogPrintsMessageWithCurrentDateAndTime
Failed asserting that '2021-07-02 11:29:09.448 Hello\r\n
' matches PCRE pattern "/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3} Hello
$/".
The reason for this is that
PHP_EOLuses "\r\n" on windows and not "\n" as expected by the test.I'm not sure if logging output should have system specific line endings. As alternativ
PHP_EOLcan be replaced by "\n" inApp:log()