Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
47 lines
1.5 KiB
PHP
47 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Design;
|
|
|
|
use Brain\Monkey\Functions;
|
|
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
|
use LIT\MCP\Integrations\Divi\Release\Call;
|
|
use LIT\MCP\Integrations\Divi\Release\DiviAdapters;
|
|
use LIT\MCP\Integrations\Divi\Release\Manifest;
|
|
use LIT\MCP\Tests\Unit\TestCase;
|
|
|
|
final class DesignSystemReaderTest extends TestCase
|
|
{
|
|
public function testIsTheRegisteredDesignAdapter(): void
|
|
{
|
|
$manifest = DesignSystemReader::manifest();
|
|
|
|
self::assertContains(DesignSystemReader::class, DiviAdapters::CLASSES);
|
|
self::assertSame(Manifest::DESIGN, $manifest->area);
|
|
self::assertSame(
|
|
['GlobalData::get_global_colors()', 'GlobalData::get_global_variables()',
|
|
'GlobalPreset::get_data()'],
|
|
array_map(static fn (Call $call): string => $call->label(), $manifest->calls)
|
|
);
|
|
self::assertSame(['et_divi'], $manifest->keys);
|
|
}
|
|
|
|
public function testDiviLogoReadsTheThemeOptions(): void
|
|
{
|
|
Functions\when('get_option')->alias(
|
|
static fn (string $name): mixed => $name === 'et_divi' ?
|
|
['divi_logo' => 'https://k.de/logo.svg'] : false
|
|
);
|
|
|
|
self::assertSame('https://k.de/logo.svg', DesignSystemReader::diviLogo());
|
|
}
|
|
|
|
public function testDiviLogoIsEmptyWithoutOptions(): void
|
|
{
|
|
Functions\when('get_option')->justReturn(false);
|
|
|
|
self::assertSame('', DesignSystemReader::diviLogo());
|
|
}
|
|
}
|