refactor: Divi design adapter, logo lookup moves out of media
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?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());
|
||||
}
|
||||
}
|
||||
@@ -20,13 +20,12 @@ use ReflectionClass;
|
||||
final class DiviBoundaryTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Files that still touch Divi outside an adapter (paths below src/). Tasks 3–7 shrink this list to
|
||||
* DiviCompatibility.php; Task 8 removes it together with testLegacyFilesStillTouchDivi.
|
||||
* Files that still touch Divi outside an adapter (paths below src/). Tasks 3–7
|
||||
* shrink this list to DiviCompatibility.php; Task 8 removes it together with
|
||||
* testLegacyFilesStillTouchDivi.
|
||||
*/
|
||||
private const LEGACY = [
|
||||
'Integrations/Divi/Design/DesignSystemReader.php',
|
||||
'Integrations/Divi/DiviCompatibility.php',
|
||||
'Integrations/Media/MediaUsageFinder.php',
|
||||
];
|
||||
|
||||
public function testOnlyAdaptersTouchDivi(): void
|
||||
|
||||
Reference in New Issue
Block a user