Files
WP-LIT-MCP/tests/Unit/Abilities/FollowUpTest.php
T
janniclas.loosenandClaude Opus 5.5 a9b2f2db71 fix: typed write failures, template rollback, parent and term cleanup
WriteFailed maps to lit_write_failed / lit_partial_write (partial writes are
logged with result partial); old template read before the update; row marker
set before wp_update_post; created terms deleted on rollback; parent must be a
readable non-descendant of a hierarchical type; featured image must be
readable; snapshot keeps empty values; meta comparison after sanitize_meta;
follow-up failures (listener, change log) only add warnings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
2026-09-25 23:11:18 +02:00

47 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Abilities;
use LIT\MCP\Abilities\FollowUp;
use LIT\MCP\Tests\Unit\TestCase;
use RuntimeException;
final class FollowUpTest extends TestCase
{
public function testReturnsTheResultOfASuccessfulStep(): void
{
$warnings = [];
self::assertSame(7, FollowUp::run(static fn (): int => 7, 'ctx', 'Warnung', $warnings));
self::assertSame([], $warnings);
}
public function testAFailingStepIsLoggedAndBecomesAWarning(): void
{
$log = (string) tempnam(sys_get_temp_dir(), 'lit-mcp-log');
$previous = ini_set('error_log', $log);
$warnings = ['alt'];
try {
$result = FollowUp::run(
static function (): void {
throw new RuntimeException('hook kaputt');
},
'lit/content-create after_save',
'Warnung',
$warnings
);
} finally {
ini_set('error_log', (string) $previous);
}
self::assertNull($result);
self::assertSame(['alt', 'Warnung'], $warnings);
self::assertStringContainsString('lit/content-create after_save', (string) file_get_contents($log));
self::assertStringContainsString('hook kaputt', (string) file_get_contents($log));
unlink($log);
}
}