feat(cache): WP Fastest Cache statt WP Super Cache
Die Cache-Integration war für WP Super Cache gebaut, eingesetzt wird aber WP Fastest Cache. Profil (wpfc), Listener, Drosselung, lit/cache-clear und Leeren-Probe laufen jetzt über die öffentlichen WPFC-Funktionen wpfc_clear_post_cache_by_id/wpfc_clear_all_cache; die Probe leert nur die Wegwerf-Seite (singleDeleteCache ohne Elternseiten) und prüft, dass WPFC den Hook noch verarbeitet. Smoke fastest-cache-smoke.sh ersetzt den WPSC-Smoke. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e1fad3dffe
commit
bee9da3a86
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\FastestCache;
|
||||
|
||||
use LIT\MCP\Compatibility\CheckStep;
|
||||
use LIT\MCP\Integrations\FastestCache\FastestCacheCheckSteps;
|
||||
use LIT\MCP\Integrations\FastestCache\FastestCacheCompatibility;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
|
||||
final class FastestCacheCheckStepsTest extends TestCase
|
||||
{
|
||||
public function testTheProbeIsSkippedWithARedManifestAndNotRun(): void
|
||||
{
|
||||
$ran = false;
|
||||
$steps = FastestCacheCheckSteps::extra(static function () use (&$ran): array {
|
||||
$ran = true;
|
||||
|
||||
return [];
|
||||
})(false);
|
||||
|
||||
self::assertCount(1, $steps);
|
||||
self::assertSame(FastestCacheCheckSteps::PROBE, $steps[0]->key);
|
||||
self::assertTrue($steps[0]->skipped);
|
||||
self::assertFalse($ran);
|
||||
}
|
||||
|
||||
public function testTheStepCarriesTheProbeProblems(): void
|
||||
{
|
||||
$steps = FastestCacheCheckSteps::extra(static fn (): array => ['rot'])(true);
|
||||
|
||||
self::assertSame(['rot'], $steps[0]->problems);
|
||||
self::assertFalse($steps[0]->skipped);
|
||||
self::assertSame('Leeren-Test an einer Wegwerf-Seite im Cache', $steps[0]->label());
|
||||
}
|
||||
|
||||
/** A switched-off cache is no red step: a skipped one would lock the purge of a site that simply caches nothing. */
|
||||
public function testWithoutAnActiveCacheTheStepIsGreenAndSaysSo(): void
|
||||
{
|
||||
$steps = FastestCacheCheckSteps::extra(static fn (): ?array => null)(true);
|
||||
|
||||
self::assertTrue($steps[0]->green());
|
||||
self::assertStringContainsString('Cache ist ausgeschaltet, nicht geprüft', $steps[0]->label());
|
||||
}
|
||||
|
||||
public function testTheLabelOfAnOldStepComesFromTheKey(): void
|
||||
{
|
||||
self::assertSame('Leeren-Test an einer Wegwerf-Seite im Cache', FastestCacheCheckSteps::label(new CheckStep(FastestCacheCheckSteps::PROBE, [])));
|
||||
self::assertSame(
|
||||
FastestCacheCompatibility::LABEL . '-Funktionen, Klassen und Registrierungen',
|
||||
FastestCacheCheckSteps::label(new CheckStep(CheckStep::MANIFEST, []))
|
||||
);
|
||||
self::assertSame('other', FastestCacheCheckSteps::label(new CheckStep('other', [])));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user