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,66 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviTouches;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class DiviTouchesTest extends TestCase
|
||||
{
|
||||
public function testFindsCallsClassesConstantsAndNames(): void
|
||||
{
|
||||
$source = <<<'PHP'
|
||||
<?php
|
||||
use ET\Builder\Packages\GlobalData\GlobalData;
|
||||
// et_comment_only() and 'et_in_a_comment' are ignored.
|
||||
/** @see et_theme_builder_get_template() */
|
||||
final class X {
|
||||
public const REGISTRY = 'ET\Builder\Packages\Module\DynamicContentOptions';
|
||||
public function a(): void {
|
||||
et_pb_is_allowed('theme_builder');
|
||||
\et_theme_builder_clear_wp_cache('all');
|
||||
\ET_Core_PageResource::remove_static_resources(1, 'all', true);
|
||||
$v = defined('ET_BUILDER_PRODUCT_VERSION') ? ET_BUILDER_PRODUCT_VERSION : '';
|
||||
get_post_meta(1, '_et_pb_use_builder', true);
|
||||
function_exists('et_');
|
||||
$this->et_method();
|
||||
Foo::et_static();
|
||||
get_option('lit_mcp_limits');
|
||||
}
|
||||
}
|
||||
PHP;
|
||||
|
||||
$touches = array_map(
|
||||
static fn (array $t): string => $t['kind'] . ':' . $t['name'],
|
||||
DiviTouches::inSource($source)
|
||||
);
|
||||
|
||||
self::assertSame(
|
||||
[
|
||||
'class:ET\Builder\Packages\GlobalData\GlobalData',
|
||||
'class:ET\Builder\Packages\Module\DynamicContentOptions',
|
||||
'function:et_pb_is_allowed',
|
||||
'function:et_theme_builder_clear_wp_cache',
|
||||
'class:ET_Core_PageResource',
|
||||
'constant:ET_BUILDER_PRODUCT_VERSION',
|
||||
'constant:ET_BUILDER_PRODUCT_VERSION',
|
||||
'string:_et_pb_use_builder',
|
||||
'string:et_',
|
||||
],
|
||||
$touches
|
||||
);
|
||||
}
|
||||
|
||||
public function testDetectsOnlyNamesTheScannerReports(): void
|
||||
{
|
||||
self::assertTrue(DiviTouches::detects('et_pb_layout'));
|
||||
self::assertTrue(DiviTouches::detects('_et_template'));
|
||||
self::assertTrue(DiviTouches::detects('ET\Builder\Packages\GlobalData\GlobalData'));
|
||||
self::assertTrue(DiviTouches::detects('ET_Core_PageResource'));
|
||||
self::assertTrue(DiviTouches::detects('ET_BUILDER_PRODUCT_VERSION'));
|
||||
self::assertFalse(DiviTouches::detects('scope'));
|
||||
self::assertFalse(DiviTouches::detects('divi/global-layout'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user