refactor: Divi catalog adapter with manifest
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,13 +33,10 @@ final class DiviBoundaryTest extends TestCase
|
||||
'Integrations/Divi/Pages/DiviFlags.php',
|
||||
'Integrations/Divi/Pages/DiviPage.php',
|
||||
'Integrations/Divi/Pages/DiviSaver.php',
|
||||
'Integrations/Divi/Pages/DynamicContentMap.php',
|
||||
'Integrations/Divi/Pages/WpLinkTargets.php',
|
||||
'Integrations/Divi/Schema/DiviModules.php',
|
||||
'Integrations/Divi/ThemeBuilder/DiviThemeBuilder.php',
|
||||
'Integrations/Media/MediaUsageFinder.php',
|
||||
'Integrations/WordPress/Content/PostPresenter.php',
|
||||
'Integrations/WordPress/Schema/ContentSchema.php',
|
||||
];
|
||||
|
||||
public function testOnlyAdaptersTouchDivi(): void
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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\Integrations\Divi\Release\Call;
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviAdapters;
|
||||
use LIT\MCP\Integrations\Divi\Release\Manifest;
|
||||
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(Manifest::CATALOG, DiviModules::manifest()->area);
|
||||
self::assertSame(Manifest::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'], $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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user