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
@@ -37,7 +37,7 @@ final class ContentSchemaTest extends TestCase
{
$this->stubPostTypes();
$schema = new ContentSchema([]);
$schema = new ContentSchema([], null, ['et_pb_layout']);
self::assertSame(['lit_person', 'page', 'post'], $schema->postTypeNames());
self::assertTrue($schema->isManaged('page'));
@@ -80,7 +80,8 @@ final class ContentSchemaTest extends TestCase
new FieldDefinition('footnotes', 'footnotes', 'string', 'meta', 'writable'),
new FieldDefinition('zz_hidden', 'Verborgen', 'string', 'pods', FieldDefinition::HIDDEN),
])],
static fn (string $type): bool => $type === 'page'
static fn (string $type): bool => $type === 'page',
['et_pb_layout']
);
$withoutFields = $schema->describe('page', false);
@@ -118,17 +119,34 @@ final class ContentSchemaTest extends TestCase
self::assertSame(['logo', 'photo'], (new ContentSchema([$source]))->mediaFieldKeys());
}
/** Spec §3: Divi's post types come from the Katalog adapter – the list itself stays the same. */
public function testExcludedPostTypesStayTheSame(): void
public function testWordPressExcludesItsOwnPostTypesAndIntegrationsAddTheirs(): void
{
$this->stubPostTypes();
self::assertSame(
['et_pb_layout', 'lit_person', 'page', 'post'],
(new ContentSchema([]))->postTypeNames(),
'without an integration the Divi layouts are an ordinary post type'
);
self::assertSame(
['page', 'post'],
(new ContentSchema([], null, ['et_pb_layout', 'lit_person']))->postTypeNames()
);
self::assertSame(
[
'attachment', 'nav_menu_item', 'revision', 'wp_block', 'wp_template', 'wp_template_part',
'wp_navigation', 'wp_global_styles', 'wp_font_family', 'wp_font_face', 'et_pb_layout',
'et_theme_builder', 'et_template', 'et_header_layout', 'et_body_layout', 'et_footer_layout',
'et_pb_canvas', '_et_pb_speculation',
'wp_navigation', 'wp_global_styles', 'wp_font_family', 'wp_font_face',
],
ContentSchema::EXCLUDED
);
}
public function testTheBuilderIsNeverOnWithoutACheck(): void
{
self::assertFalse((new ContentSchema([]))->diviEnabled('page'));
$schema = new ContentSchema([], static fn (string $type): bool => $type === 'page');
self::assertTrue($schema->diviEnabled('page'));
self::assertFalse($schema->diviEnabled('post'));
}
}