Skip to content

Add comprehensive CLI command black-box tests#238

Open
lucatume wants to merge 6 commits into3.0.0from
test/cli
Open

Add comprehensive CLI command black-box tests#238
lucatume wants to merge 6 commits into3.0.0from
test/cli

Conversation

@lucatume
Copy link
Copy Markdown
Contributor

Summary

  • Add 153 black-box tests (242 assertions) covering all slic CLI commands
  • Tests control only working directory, files on disk, env vars, and CLI args; assert only on stdout/stderr output
  • Add test infrastructure: git mock binary, docker host-ip mock, stdin closing in slicExec() to prevent interactive prompts from blocking
  • Fix missing echo in mysql help command (help text was built but never output)

Add 153 tests covering all slic CLI commands using black-box testing
approach (control working directory, files, env vars, CLI args; assert
on stdout/stderr output).

Includes test infrastructure improvements:
- Close stdin in slicExec to prevent interactive prompts from blocking
- Add git mock binary to prevent real git clone calls from hanging
- Set SLIC_INTERACTIVE=0 as defense-in-depth against readline prompts

Fix missing echo in mysql help command (help text was built but never
output).
@lucatume lucatume self-assigned this Feb 25, 2026
@lucatume lucatume mentioned this pull request Feb 25, 2026
Set dummy SSH_AUTH_SOCK, isolated SLIC_CACHE_DIR, and deterministic
HOME in test harness to avoid CI-specific failures.
@lucatume lucatume marked this pull request as ready for review February 25, 2026 16:47
Add $stdin parameter to slicExec() to support piping input to
interactive commands. When provided, uses proc_open() with
SLIC_INTERACTIVE=1 instead of shell_exec() with /dev/null.
Add interactive tests for the target command flow.
- Add createTempDir() helper to BaseTestCase with automatic tearDown cleanup
- Guard proc_open and fwrite (including partial writes) with $this->fail()
- Merge stderr via 2>&1 in proc_open path to match shell_exec behavior
- Cast stream_get_contents to string to handle false return
- Document small-payload deadlock limitation in slicExec() PHPDoc
- Add completion install confirm test verifying .bashrc is written
- Add completion install decline test verifying cancellation
- Add completion install fish confirm test verifying symlink creation
- Add site-cli _install decline test verifying command does not execute
- Consolidate target interactive tests into single test with exact prompts
- Fix pre-existing @rmdir in test_completion_no_args to use createTempDir()
@lucatume lucatume requested review from bordoni and defunctl February 26, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants