Skip to content

License sync#9

Merged
shazzad merged 3 commits into
mainfrom
license-sync
Feb 25, 2026
Merged

License sync#9
shazzad merged 3 commits into
mainfrom
license-sync

Conversation

@shazzad
Copy link
Copy Markdown
Owner

@shazzad shazzad commented Feb 25, 2026

Summary

License sync button

  • Add a "Sync" button next to the license key input on the admin page, allowing manual refresh of license data without re-saving the key.
  • Extract handle_sync() and handle_save() private methods from load_page() for cleaner separation of the two POST actions.

Extract Client class

  • Create src/Client.php with typed public methods: ping(), check_license($license), updates(), details() — replacing the generic Integration::api_request($method, $license) dispatcher.
  • Private request() method contains shared HTTP/response logic (URL building, common query args, JSON parsing, error handling).

Store subsystem instances on Integration

  • Add public properties $client, $updater, $tracker, $admin to Integration.
  • Constructor now stores all subsystem instances instead of discarding them, so classes can reach each other through $this->integration->client, $this->integration->updater, etc.

Update callers

  • Updater.php (3 call sites): api_request('updates')client->updates(), etc.
  • Admin.php (3 call sites): api_request('check_license', $key)client->check_license($key), etc.
  • Tracker.php (4 call sites): api_request('ping')client->ping(), etc.

Update tests

  • Rename IntegrationApiRequestTestClientApiRequestTest — all tests now exercise $integration->client->method() directly.
  • UpdaterPreSetTransientTest now uses $integration->updater instead of creating redundant new Updater() instances.
  • Add details_returns_plugin_details test case.

Update docs

  • CLAUDE.md and README.md updated to reflect the new Client class, stored subsystem properties, and corrected file structure.

Test plan

  • composer test — 39 tests, 70 assertions, all pass
  • Manual: verify license admin page renders correctly with sync button
  • Manual: verify update checks still inject data into WordPress transient
  • Manual: verify license sync cron and activation/deactivation pings work

shazzad and others added 3 commits February 25, 2026 21:59
Rename IntegrationApiRequestTest to ClientApiRequestTest, testing
$integration->client methods directly. Update UpdaterPreSetTransientTest
to use $integration->updater instead of creating redundant instances.
Update CLAUDE.md and README.md to reflect the new Client class and
stored subsystem properties.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shazzad shazzad merged commit b585609 into main Feb 25, 2026
1 check passed
@shazzad shazzad deleted the license-sync branch February 25, 2026 16:24
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