refactor: Kern ohne Divi – Ports BuilderDetector, MediaUsageSource, EnvironmentComponent und ausgeschlossene Post-Typen im ContentSchema; Divi-Implementierungen und Verdrahtung über DiviIntegration/Plugin; CoreIndependenceTest

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-18 21:49:28 +02:00
co-authored by Claude Sonnet 5.5
parent abeb4b0eed
commit 06148fb8c1
33 changed files with 952 additions and 154 deletions
@@ -13,6 +13,7 @@ use LIT\MCP\Integrations\WordPress\Content\ContentUpdateAbility;
use LIT\MCP\Integrations\WordPress\Content\PostPresenter;
use LIT\MCP\Integrations\WordPress\Content\PostWriter;
use LIT\MCP\Integrations\WordPress\Schema\ContentSchema;
use LIT\MCP\Tests\Support\FakeBuilderDetector;
use LIT\MCP\Tests\Support\FakeChangeLog;
use LIT\MCP\Tests\Support\SchemaFixture;
use LIT\MCP\Tests\Unit\TestCase;
@@ -46,9 +47,12 @@ final class ContentUpdateAbilityTest extends TestCase
return $schema;
}
private function ability(PostWriter $writer, ?ChangeLog $log = null): ContentUpdateAbility
{
return new ContentUpdateAbility($this->schema(), $writer, $log ?? FakeChangeLog::forbidden());
private function ability(
PostWriter $writer,
?ChangeLog $log = null,
?PostPresenter $presenter = null
): ContentUpdateAbility {
return new ContentUpdateAbility($this->schema(), $writer, $log ?? FakeChangeLog::forbidden(), $presenter);
}
public function testRevIsRequired(): void
@@ -110,11 +114,11 @@ final class ContentUpdateAbilityTest extends TestCase
public function testRawContentOnDiviPagesIsUnsupported(): void
{
Functions\when('get_post_meta')->justReturn('on');
$writer = Mockery::mock(PostWriter::class);
$writer->expects('prepare')->never();
$presenter = new PostPresenter($this->schema(), new FakeBuilderDetector(false, [5]));
$result = $this->ability($writer)
$result = $this->ability($writer, null, $presenter)
->execute(['post_id' => 5, 'rev' => Rev::ofPost($this->post), 'content' => '<p>Neu</p>']);
self::assertToolError($result, 'unsupported');