Skip to content

initial unified base tests#106

Open
jaysomani wants to merge 9 commits into
utopia-php:mainfrom
jaysomani:feat/unified-base-tests
Open

initial unified base tests#106
jaysomani wants to merge 9 commits into
utopia-php:mainfrom
jaysomani:feat/unified-base-tests

Conversation

@jaysomani
Copy link
Copy Markdown
Contributor

@jaysomani jaysomani commented May 22, 2026

Migrates all shared adapter tests into Base.php following the dynamic pattern. All tests now create repos dynamically with uniqid() and clean up in finally blocks — no hardcoded owners, repos, or IDs.
Key changes:

Base.php fully rewritten with shared dynamic tests covering repository CRUD, tree, content, branches, commits, clone commands, pull requests, comments, search and owner
All adapter files implement setupAdapter() instead of setUp()
static::$owner and static::$defaultBranch used throughout
Duplicate tests removed from GiteaTest, GitLabTest, GitHubTest
Adapter-specific tests kept only where behavior genuinely differs
getOwnerName made consistent across GitLab and Gitea — requires repositoryId
Admin username changed to root across all adapters for consistency
testListBranchesEmptyRepo skipped in Base — each adapter overrides correctly

@jaysomani jaysomani changed the title inital testing initial unified base tests May 22, 2026
@jaysomani jaysomani marked this pull request as ready for review May 25, 2026 04:34
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f46cf912a

ℹ️ 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".

Comment thread tests/VCS/Base.php Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 25, 2026

Greptile Summary

This PR consolidates shared adapter tests into Base.php using a dynamic setup pattern (setupAdapter(), uniqid()-based repo names, finally-block cleanup). Duplicate tests are removed from GiteaTest, GitLabTest, and GitHubTest, and the GitLab getOwnerName fallback to /user is removed in favour of always requiring a repositoryId.

  • Base.php is fully rewritten with ~35 shared dynamic tests covering the full adapter surface; adapter-specific overrides remain only where behaviour genuinely differs.
  • All test files replace setUp()/createVCSAdapter() with a single setupAdapter() method that instantiates the adapter and sets static::$owner.
  • docker-compose.yml changes the default admin username to root for Gitea, Forgejo, and Gogs, aligning with the new testGetUser('root') assertion in Base.

Confidence Score: 5/5

Safe to merge; changes are confined to test infrastructure and one clarifying non-functional tightening of a GitLab adapter method.

The production code change (GitLab getOwnerName) removes a fallback path that was acknowledged as intentionally wrong, and all call sites within the repo now pass a valid repositoryId. The test consolidation is mechanical and well-structured. The two findings are both cosmetic: a stale comment and a missing finally in a Gitea-only test override.

tests/VCS/Adapter/GiteaTest.php — stale comment and missing finally in testGetRepositoryName.

Important Files Changed

Filename Overview
tests/VCS/Base.php Base class fully rewritten with shared dynamic tests; setUp now delegates to abstract setupAdapter(). testCreateRepositoryWithInvalidName was not added to Base so Gitea/GitHub adapters skip it.
src/VCS/Adapter/Git/GitLab.php getOwnerName now throws when repositoryId is null/<=0 instead of falling back to /user endpoint; breaking change acknowledged as intentional.
tests/VCS/Adapter/GiteaTest.php Migrated to setupAdapter(). testGetRepositoryName override is missing a finally block; stale comment in testListBranchesEmptyRepo references a non-existent hardcoded owner.
tests/VCS/Adapter/GitLabTest.php Migrated to setupAdapter(); duplicate tests removed. testCreateRepositoryWithInvalidName now correctly uses expectException.
tests/VCS/Adapter/GitHubTest.php Migrated to setupAdapter(); large number of duplicate tests removed. New testGetOwnerName override correctly uses installationId only.
tests/VCS/Adapter/ForgejoTest.php Cleanly migrated from setUp/createVCSAdapter to setupAdapter(); no issues identified.
tests/VCS/Adapter/GogsTest.php Migrated to setupAdapter() pattern; no issues identified.
docker-compose.yml Admin username default changed from 'utopia' to 'root' for Gitea, Forgejo, and Gogs; aligns with testGetUser('root') in Base.

Reviews (8): Last reviewed commit: "Merge branch 'main' of https://github.co..." | Re-trigger Greptile

Comment thread tests/VCS/Base.php
Comment thread src/VCS/Adapter/Git/GitLab.php
Comment thread tests/VCS/Base.php Outdated
Comment thread tests/VCS/Base.php
Comment thread tests/VCS/Base.php
Comment thread tests/VCS/Base.php Outdated
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.

1 participant