DiviThemeBuilder wraps Divi's Theme Builder: reads through Divi's functions, writes layouts/templates through insert_layout/store_template behind a wp_die guard (edit_others_posts and function checks first, every handler filter and output buffer restored in finally), list/conditions/enabled mirrored from Divi's own save. Template: live = attached and enabled, whatever the post status (ruling Q8/B8). ThemeBuilderAccess: edit_others_posts plus Divi's theme_builder role, hidden IDs answer like missing ones, canEditTemplate (B11) and layoutsRefusal (B10). DiviCompatibility checks the Theme Builder functions and post types (E15). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
55 lines
1.9 KiB
PHP
55 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LIT\MCP\Tests\Unit\Integrations\Divi;
|
|
|
|
use LIT\MCP\Integrations\Divi\DiviCompatibility;
|
|
use PHPUnit\Framework\TestCase;
|
|
use RuntimeException;
|
|
|
|
final class DiviCompatibilityTest extends TestCase
|
|
{
|
|
public function testListsFailedAndThrowingChecks(): void
|
|
{
|
|
$compatibility = new DiviCompatibility([
|
|
'A' => static fn (): bool => true,
|
|
'B' => static fn (): bool => false,
|
|
'C' => static function (): bool {
|
|
throw new RuntimeException('Divi changed');
|
|
},
|
|
]);
|
|
|
|
self::assertSame(['B', 'C'], $compatibility->problems());
|
|
}
|
|
|
|
public function testDefaultsCoverTheDiviInternalsInUse(): void
|
|
{
|
|
self::assertSame(
|
|
[
|
|
'ModuleRegistration (Modul-Katalog)',
|
|
'DynamicContentOptions (Dynamic Content)',
|
|
'et_pb_is_allowed (Divi-Rollen)',
|
|
'Post-Typ et_pb_layout (Bibliothek)',
|
|
'Taxonomien scope, layout_type, module_width (Bibliothek)',
|
|
'GlobalLayout::is_global_layout_template (globale Module)',
|
|
'ET_Core_PageResource (CSS-Cache)',
|
|
'et_theme_builder_clear_wp_cache (Theme-Builder-Cache)',
|
|
'Block-Typ divi/global-layout (Instanzen globaler Module)',
|
|
'Taxonomien layout_category, layout_tag (Bibliothek)',
|
|
'Theme Builder: Funktionen et_theme_builder_* und et_()',
|
|
'Theme Builder: Post-Typen et_template und Layouts',
|
|
],
|
|
array_keys(DiviCompatibility::defaults())
|
|
);
|
|
}
|
|
|
|
public function testChecksTheThemeBuilderInternals(): void
|
|
{
|
|
$labels = array_keys(DiviCompatibility::defaults());
|
|
|
|
self::assertContains('Theme Builder: Funktionen et_theme_builder_* und et_()', $labels);
|
|
self::assertContains('Theme Builder: Post-Typen et_template und Layouts', $labels);
|
|
}
|
|
}
|