feat(cache): Verhaltensprobe und Smoke für WP Super Cache
SuperCacheProbe prüft beim Prüfen, ob wp_cache_post_edit die Cache-Datei einer Testseite entfernt; während der Probe ist nur der Einzelseiten-Purge erlaubt, der Pfad kommt aus home und es werden nur feste Dateinamen gelöscht. ProbeStep bündelt die Schrittlogik von Pods und WP Super Cache; ThrowawayPost hält Marker und Titel zentral und räumt auch private Probe-Seiten auf (WP Super Cache wie Pods beim Laden des Reiters). super-cache-smoke.sh prüft gegen das echte Plugin; lib.sh sperrt parallele Smoke-Läufe per flock, wp-config.php wird atomar wiederhergestellt. Doku: Host-Abhängigkeit des Einzel-Purges, WP-Cron für den Nachlauf, Komplett-Purge durch Divi beim Prüfen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
05bf890481
commit
661d3945fd
@@ -4,7 +4,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\SuperCache;
|
||||
|
||||
use Brain\Monkey\Functions;
|
||||
use LIT\MCP\Admin\CompatibilityTab;
|
||||
use LIT\MCP\Compatibility\ProvidesCompatibility;
|
||||
use LIT\MCP\Integrations\Bootable;
|
||||
use LIT\MCP\Integrations\Integration;
|
||||
use LIT\MCP\Integrations\SuperCache\SuperCacheCompatibility;
|
||||
use LIT\MCP\Integrations\SuperCache\SuperCacheIntegration;
|
||||
@@ -28,4 +31,38 @@ final class SuperCacheIntegrationTest extends TestCase
|
||||
{
|
||||
self::assertSame(defined('WPCACHEHOME'), (new SuperCacheIntegration())->isAvailable());
|
||||
}
|
||||
|
||||
public function testBootHooksTheOrphanCleanupIntoTheProfileLoad(): void
|
||||
{
|
||||
$integration = new SuperCacheIntegration();
|
||||
$integration->boot();
|
||||
|
||||
self::assertInstanceOf(Bootable::class, $integration);
|
||||
self::assertNotFalse(has_action(CompatibilityTab::LOAD_ACTION, [$integration, 'removeOrphans']));
|
||||
}
|
||||
|
||||
public function testNoCleanupForAnotherProfileWithoutWpscOrWithoutTheCapability(): void
|
||||
{
|
||||
Functions\expect('get_posts')->never();
|
||||
Functions\when('current_user_can')->justReturn(true);
|
||||
(new SuperCacheIntegration(static fn (): bool => true))->removeOrphans('pods');
|
||||
(new SuperCacheIntegration(static fn (): bool => false))->removeOrphans('wpsc');
|
||||
|
||||
Functions\when('current_user_can')->justReturn(false);
|
||||
(new SuperCacheIntegration(static fn (): bool => true))->removeOrphans('wpsc');
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testCleansUpPagesForTheAdministratorWithWpsc(): void
|
||||
{
|
||||
Functions\when('current_user_can')->justReturn(true);
|
||||
Functions\expect('get_posts')->once()->andReturnUsing(static function (array $args): array {
|
||||
self::assertSame('page', $args['post_type']);
|
||||
self::assertSame(['draft', 'private'], $args['post_status']);
|
||||
|
||||
return [];
|
||||
});
|
||||
|
||||
(new SuperCacheIntegration(static fn (): bool => true))->removeOrphans('wpsc');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user