-
Notifications
You must be signed in to change notification settings - Fork 15
Fix local #5
Conversation
…nly option that is populated when running in the PHP built in web server.
…y as we're messing with globals by design in this library and its tests.
Writing tests when working on a (testable) piece of code, is the correct approach. thumbs up Tested this code on my local environment and it seems to work. I have some objections, which I like to share with you Larry. Is it necessary to work with this PHP function, instead of a Symfony kernel event listener? Also it seems a bit uncommon to set the $_SESSION variable directly, without the session component from Symfony (http://symfony.com/doc/current/components/http_foundation/sessions.html). Your tests do not have a return type defined. As of PHP 7, you can define that:
The mapPlatformShEnvironment() function is a mix of if-cases and a switch table. You are only comparing and mapping here. Have you thought of using lookup tables like in the following JavaScript code example? The following example shows via JavaScript, how a long function with if-cases can be shortened and made more readable by a lookup table.
Will become this:
|
Another objection: do you like to squash your Git commits to 1 commit for easier Git history readability with the GitHub issue ID in it?: https://mobilefish.de/git-swipe-log-branch-history-and-create-just-one-commit |
Thanks, @jepster.
|
You made me a PR I couldn't refuse... |
The current code doesn't work properly in a local environment, as the detection to determine if the code is running on build or live is buggy. That's easy enough to fix, but while I was at it I figured what the hell, let's test this puppy!
So, here's a major overhaul and cleanup that includes a bunch of tests to make sure it all works.