Point plugin metadata links at Unsupervised and Gitea
CI / No Debug Code (pull_request) Successful in 4s
CI / Tests (PHP 8.2) (pull_request) Successful in 39s
CI / Tests (PHP 8.1) (pull_request) Successful in 1m21s
CI / Coding Standards (pull_request) Successful in 2m52s
CI / PHPStan (pull_request) Successful in 2m53s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m36s
CI / Build Plugin Zip (pull_request) Skipped
CI / No Debug Code (pull_request) Successful in 4s
CI / Tests (PHP 8.2) (pull_request) Successful in 39s
CI / Tests (PHP 8.1) (pull_request) Successful in 1m21s
CI / Coding Standards (pull_request) Successful in 2m52s
CI / PHPStan (pull_request) Successful in 2m53s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m36s
CI / Build Plugin Zip (pull_request) Skipped
Make the "By Unsupervised" author link go to https://unsupervised.ca (via a new Author URI header) and the plugin site / "View details" link point at the Gitea project instead of WordPress.org. Core's "View details" link opened a thickbox iframe against the WordPress.org plugin-information API, which 404s ("Plugin not found") for this off-directory plugin. A plugin_row_meta filter now replaces it with a new-tab link to the matching Gitea release tag page; embedding Gitea in the iframe is blocked by its X-Frame-Options anyway. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
@@ -35,10 +35,45 @@ class UpdateCheckerTest extends TestCase
|
||||
public function testRegisterHooksHostnameFilter(): void
|
||||
{
|
||||
Filters\expectAdded('update_plugins_git.unsupervised.ca')->once();
|
||||
Filters\expectAdded('plugin_row_meta')->once();
|
||||
|
||||
(new UpdateChecker())->register();
|
||||
}
|
||||
|
||||
public function testFilterRowMetaReplacesViewDetailsLinkForThisPlugin(): void
|
||||
{
|
||||
Functions\when('plugin_basename')->justReturn(self::PLUGIN_FILE);
|
||||
|
||||
$meta = [
|
||||
'Version 1.0.0',
|
||||
'<a href="https://wordpress.org/plugin-install.php?...&plugin=unsupervised-schedular" class="thickbox open-plugin-details-modal">View details</a>',
|
||||
];
|
||||
|
||||
$result = (new UpdateChecker())->filterRowMeta($meta, self::PLUGIN_FILE);
|
||||
|
||||
// Core's thickbox modal link is gone.
|
||||
foreach ($result as $item) {
|
||||
self::assertStringNotContainsString('open-plugin-details-modal', $item);
|
||||
}
|
||||
// Replaced with a new-tab link to the Gitea release tag for USC_VERSION (1.0.0 in tests).
|
||||
self::assertStringContainsString(
|
||||
UpdateChecker::REPO_URL . '/releases/tag/v1.0.0',
|
||||
end($result)
|
||||
);
|
||||
self::assertStringContainsString('target="_blank"', end($result));
|
||||
}
|
||||
|
||||
public function testFilterRowMetaLeavesOtherPluginsUntouched(): void
|
||||
{
|
||||
Functions\when('plugin_basename')->justReturn(self::PLUGIN_FILE);
|
||||
|
||||
$meta = ['<a href="#" class="thickbox open-plugin-details-modal">View details</a>'];
|
||||
|
||||
$result = (new UpdateChecker())->filterRowMeta($meta, 'other-plugin/other-plugin.php');
|
||||
|
||||
self::assertSame($meta, $result);
|
||||
}
|
||||
|
||||
public function testOffersUpdateWhenReleaseIsNewer(): void
|
||||
{
|
||||
Functions\when('plugin_basename')->justReturn(self::PLUGIN_FILE);
|
||||
|
||||
Reference in New Issue
Block a user