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.
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
Rename Path to BasePath #393
base: master
Are you sure you want to change the base?
Rename Path to BasePath #393
Changes from 1 commit
ab255bf
6cc3dc0
dc3cb4f
e3eb851
7bb2741
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider making
DIRECTORY_SEPARATOR
injectable for thePath
class. That way unit tests are going to be system agnostic.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't they now? These tests pass both on windows and unix currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, to be able to test windows behavior you need to run tests on windows VM. You can't be sure this code works correctly with windows when running tests on a unix-based system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@budziam Is there a feature request to build Windows paths on Unix and vice-versa? Because if there isn't, there's no way to test it. And to test it, it would mean to require that functionallity. However it seems off, doesn't it?
Perhaps to test it both on windows and unix, we can employ the same strategy we use for testing both php8 and php7, which are github actions. It wouldn't be too hard to create runner-
matrix
with valuesruns-on: ubuntu-latest
andruns-on: windows-latest
(alsomacos-lates
is also available). We can also design thematrix
in such a way that testsphp5.6
-php8.1
run on ubuntu, and only one version of php runs on windows, to save resources and time.Tests would become more flexible, yes, but the implementation would become less cohesive.
If you parametrize the separator, a smart way to do would be for example to throw exception if someone passes
"|"
or""
as a separator, but that's unnecessary logic that will never be used in production, since 100% usages will be "build windows path on windows" or "build unix path on unix".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CPU costs money and shop sms was never intended to be run on windows instances. Running tests against windows VMs is not an acceptable approach.
That leaves us with 2 options:
DIRECTORY_SEPARATOR
on the global level (I don't know if that's even possible)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github Actions cost money?
We either support windows or we don't.
If we do, running CI/CD on windows is a good idea. If we don't, then this dilema doesn't make sense and making
Path
work on Windows doesn't make sense anyway.But I understand - you work on Unix machine, and want to make sure it works on Windows, without running windows yourself. That makes sense.