test: rewrite GitHub adapter tests to be fully dynamic#95
Conversation
Greptile SummaryThis PR rewrites Confidence Score: 5/5Safe to merge; all findings are P2 and do not affect production runtime behavior. No P0 or P1 issues found. The two P2 findings (semantic misuse of RepositoryNotFound and expectException inside try/finally) are quality concerns that do not cause production failures or test failures under normal CI conditions. Minor attention to src/VCS/Adapter/Git/GitHub.php lines 775-776 and 813-814 for the RepositoryNotFound semantic issue. Important Files Changed
Reviews (3): Last reviewed commit: "uupdated with lint" | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 706a5362e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…hub-tests-rewrite
…ani/vcs into feat/github-tests-rewrite
Rewrites GitHubTest.php from hardcoded fixtures to fully dynamic tests following the same pattern as GitLab and Gitea adapters.
Changes:
All tests now create repositories dynamically with uniqid() and clean up in finally blocks
Owner resolved dynamically via getOwnerName() — works with any GitHub App installation, no hardcoding
setUp now skips gracefully when credentials are missing instead of erroring
Added str_replace('\n', "\n", ...) in setUp for local env compatibility (no-op on CI)
35 dynamic tests passing, 7 skipped (require createBranch/createPullRequest which are not implemented in GitHub adapter)
Also fixes in GitHub.php:
getRepository now throws RepositoryNotFound on 404 instead of returning raw error response
getCommit now throws RepositoryNotFound on 404/422 instead of returning empty commit struct
New tests added: testCreatePrivateRepository, testGetDeletedRepositoryFails, testDeleteRepository, testDeleteNonExistingRepositoryFails, testGetRepositoryNameWithInvalidId, testGetRepositoryTreeWithInvalidBranch, testGetRepositoryContentWithRef, testGetRepositoryContentFileNotFound, testGetRepositoryContentCaseSensitive, testListRepositoryContentsNonExistingPath, testListRepositoryLanguages, testListBranches, testGetCommitWithInvalidHash, testGetLatestCommitWithInvalidBranch, testUpdateCommitStatus, testGenerateCloneCommandWithInvalidRepository, testGetOwnerName, testSearchRepositories, testValidateWebhookEvent, testGetEventInstallation
Note: testGenerateCloneCommandWithTag (wildcard tags) not included as createTag is not implemented in GitHub adapter.