Files
Jan-Niclas LoosenandClaude Opus 5.5 b511ef6348 refactor(compat): Prüfbausteine nach src/Compatibility, Matrix und ManifestCheck generisch
Requirement, Call, ConstantRequirement, Mirror, Problem, FeatureStatus, CompatibilityMatrix, Manifest, ManifestCheck sowie Fingerprints und LineDiff liegen jetzt im divi-freien Kern. Neu: GlobalRequirement, CompatibilityMatrix::fromProblems(), ManifestCheck-Option signatures, DiviManifestCheck::create() und DiviAreas. Divi-Verhalten unverändert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 12:03:30 +01:00

64 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Schema;
use Brain\Monkey\Functions;
use LIT\MCP\Integrations\Divi\Pages\DynamicContentMap;
use LIT\MCP\Compatibility\Call;
use LIT\MCP\Compatibility\ConstantRequirement;
use LIT\MCP\Integrations\Divi\Release\DiviAdapters;
use LIT\MCP\Integrations\Divi\Release\DiviAreas;
use LIT\MCP\Integrations\Divi\Schema\DiviModules;
use LIT\MCP\Tests\Unit\TestCase;
final class DiviModulesTest extends TestCase
{
public function testCatalogAdaptersAreRegistered(): void
{
self::assertContains(DiviModules::class, DiviAdapters::CLASSES);
self::assertContains(DynamicContentMap::class, DiviAdapters::CLASSES);
self::assertSame(DiviAreas::CATALOG, DiviModules::manifest()->area);
self::assertSame(DiviAreas::CATALOG, DynamicContentMap::manifest()->area);
}
public function testManifestListsModuleRegistrationAndTheBuilderSwitch(): void
{
$manifest = DiviModules::manifest();
self::assertSame(
[
'ModuleRegistration::get_all_core_modules_metadata()',
'ModuleRegistration::get_default_attrs()',
'et_builder_enabled_for_post_type()',
],
array_map(static fn (Call $call): string => $call->label(), $manifest->calls)
);
self::assertSame(['divi/global-layout'], $manifest->blockTypes);
self::assertSame(
['ET_BUILDER_PRODUCT_VERSION'],
array_map(static fn (ConstantRequirement $constant): string => $constant->name, $manifest->constants)
);
}
public function testInternalPostTypesAreDivisOwn(): void
{
self::assertSame(
[
'et_pb_layout', 'et_theme_builder', 'et_template', 'et_header_layout', 'et_body_layout',
'et_footer_layout', 'et_pb_canvas', '_et_pb_speculation',
],
DiviModules::INTERNAL_POST_TYPES
);
}
public function testBuilderEnabledForAsksDivi(): void
{
Functions\when('et_builder_enabled_for_post_type')->alias(static fn (string $type): bool => $type === 'page');
self::assertTrue(DiviModules::builderEnabledFor('page'));
self::assertFalse(DiviModules::builderEnabledFor('post'));
}
}