• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

igancev / work-reporter / 26840888106

02 Jun 2026 06:47PM UTC coverage: 98.987% (-0.8%) from 99.795%
26840888106

push

github

web-flow
fix: resolve home directory via cross-platform helper (partial #68) (#87)

InitCommand and YamlConfigProvider read \`getenv('HOME')\` directly to
expand the leading \`~\` in the default config path. On Windows that env
var is usually unset (the OS uses \`USERPROFILE\` plus optional
\`HOMEDRIVE\` / \`HOMEPATH\` as the fallback chain), so \`~/.config/...\`
quietly resolved to \`/.config/...\` at filesystem root and \`init\` /
\`work:report\` silently misbehaved.

Introduce \`Igancev\\WorkReporter\\Platform\\HomeDirectory::resolve()\`
that returns the canonical home path per platform: \`HOME\` on POSIX,
\`USERPROFILE\` on Windows with the documented \`HOMEDRIVE\` + \`HOMEPATH\`
fallback for containers/services that strip \`USERPROFILE\`. The helper
returns an empty string when nothing is set so callers see the same
shape as the prior \`(string)getenv(...)\` cast.

Scope: only the env-var leg of #68's checklist. CI workflow for the
Windows binary, README install section, and end-to-end Windows binary
verification are intentionally left for follow-up PRs so each item
stays atomic per CLAUDE.md / CONTRIBUTING.md guidance.

Verification:

    vendor/bin/phpunit tests/Unit/Platform/HomeDirectoryTest.php
    vendor/bin/phpunit tests/Unit/InitCommandTest.php \
        tests/Unit/Config/YamlConfigProviderTest.php
    make cs
    make stat-analyze

all pass on macOS (POSIX path); the Windows-only assertions are
skipped on POSIX runners and exercised on a future Windows CI lane.

5 of 13 new or added lines in 3 files covered. (38.46%)

977 of 987 relevant lines covered (98.99%)

6.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

27.27
/src/Platform/HomeDirectory.php


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc