cli/cmd/updater/mock_github_client_test.go
Charon c340303314 refactor: flatten commands, extract php/ci to own repos (#2)
## Summary
- Extract PHP/Laravel commands to `core/php` repo (42 files, standalone module)
- Extract CI/release + SDK commands to `core/ci` repo (10 files)
- Remove `internal/variants/` build tag system entirely
- Move all 30 remaining command packages from `internal/cmd/` to top-level `cmd/`
- Rewrite `main.go` with direct imports — no more variant selection
- PHP and CI are now optional via commented import lines in main.go

Co-authored-by: Claude <developers@lethean.io>
Reviewed-on: #2
Co-authored-by: Charon <charon@lthn.ai>
Co-committed-by: Charon <charon@lthn.ai>
2026-02-16 14:45:06 +00:00

36 lines
1.4 KiB
Go

package updater
import (
"context"
)
// MockGithubClient is a mock implementation of the GithubClient interface for testing.
type MockGithubClient struct {
GetLatestReleaseFunc func(ctx context.Context, owner, repo, channel string) (*Release, error)
GetReleaseByPullRequestFunc func(ctx context.Context, owner, repo string, prNumber int) (*Release, error)
GetPublicReposFunc func(ctx context.Context, userOrOrg string) ([]string, error)
}
// GetLatestRelease mocks the GetLatestRelease method of the GithubClient interface.
func (m *MockGithubClient) GetLatestRelease(ctx context.Context, owner, repo, channel string) (*Release, error) {
if m.GetLatestReleaseFunc != nil {
return m.GetLatestReleaseFunc(ctx, owner, repo, channel)
}
return nil, nil
}
// GetReleaseByPullRequest mocks the GetReleaseByPullRequest method of the GithubClient interface.
func (m *MockGithubClient) GetReleaseByPullRequest(ctx context.Context, owner, repo string, prNumber int) (*Release, error) {
if m.GetReleaseByPullRequestFunc != nil {
return m.GetReleaseByPullRequestFunc(ctx, owner, repo, prNumber)
}
return nil, nil
}
// GetPublicRepos mocks the GetPublicRepos method of the GithubClient interface.
func (m *MockGithubClient) GetPublicRepos(ctx context.Context, userOrOrg string) ([]string, error) {
if m.GetPublicReposFunc != nil {
return m.GetPublicReposFunc(ctx, userOrOrg)
}
return []string{"repo1", "repo2"}, nil
}