feat: Divi manifests, adapter register and boundary test
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\Release\Call;
|
||||
use LIT\MCP\Integrations\Divi\Release\Manifest;
|
||||
use LIT\MCP\Integrations\Divi\Release\Mirror;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class ManifestTest extends TestCase
|
||||
{
|
||||
public function testCallsKnowTheirClassMemberAndLabel(): void
|
||||
{
|
||||
$function = new Call('et_pb_is_allowed', 1);
|
||||
$method = new Call('ET\Builder\Packages\GlobalData\GlobalData::get_global_colors', 0);
|
||||
|
||||
self::assertNull($function->className());
|
||||
self::assertSame('et_pb_is_allowed', $function->member());
|
||||
self::assertSame('et_pb_is_allowed()', $function->label());
|
||||
self::assertSame('ET\Builder\Packages\GlobalData\GlobalData', $method->className());
|
||||
self::assertSame('get_global_colors', $method->member());
|
||||
self::assertSame('GlobalData::get_global_colors()', $method->label());
|
||||
self::assertSame('ET_Core_PageResource', (new Call('\ET_Core_PageResource::remove_static_resources', 3))->className());
|
||||
}
|
||||
|
||||
public function testMirrorLabel(): void
|
||||
{
|
||||
$function = new Mirror('tb-api-save', 'includes/api.php', 'et_theme_builder_api_save', null, 'Vorlagenliste');
|
||||
$method = new Mirror('vb-flags', 'x.php', 'update', 'SyncToServerController', 'Kennzeichen');
|
||||
|
||||
self::assertSame('et_theme_builder_api_save()', $function->label());
|
||||
self::assertSame('SyncToServerController::update()', $method->label());
|
||||
}
|
||||
|
||||
public function testNamesListEveryDeclaredDiviName(): void
|
||||
{
|
||||
$manifest = new Manifest(
|
||||
Manifest::LIBRARY,
|
||||
calls: [new Call('et_pb_is_allowed', 1), new Call('ET\Builder\GlobalLayout::is_global_layout_template', 1)],
|
||||
constants: ['ET_BUILDER_PRODUCT_VERSION'],
|
||||
postTypes: ['et_pb_layout'],
|
||||
taxonomies: ['scope'],
|
||||
blockTypes: ['divi/global-layout'],
|
||||
keys: ['_et_pb_module_type']
|
||||
);
|
||||
|
||||
self::assertSame(
|
||||
['et_pb_is_allowed', 'ET\Builder\GlobalLayout', 'ET_BUILDER_PRODUCT_VERSION', 'et_pb_layout', 'scope',
|
||||
'_et_pb_module_type'],
|
||||
$manifest->names()
|
||||
);
|
||||
self::assertSame('Bibliothek', $manifest->area);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user