Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
60 lines
2.1 KiB
PHP
60 lines
2.1 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\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'));
|
|
}
|
|
}
|